
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Area of a leaf inside a square?
Here we will see how to get the area of a leaf-like below, which is present inside the square ABCD. Each side of the square is of length ‘a’.
The leaf has two equal parts. Area of each part is said p, now −
And the area of the full leaf is 2p.
Example
#include <iostream> using namespace std; float leafArea(float a){ return (a * a * (3.1415/2 - 1)); } int main() { float square_side = 7.0f; cout << "Leaf Area: " << leafArea(square_side); }
Output
Leaf Area: 27.9667
Advertisements