Saved Bookmarks
| 1. |
Write a program to find the area of pentagon using function |
|
Answer» // C++ program to find the area of Pentagon #include using namespace std; // FUNCTION to find area of pentagon FLOAT findArea(float a) { float area; // Formula to find area area = (sqrt(5 * (5 + 2 * (sqrt(5)))) * a * a) / 4; return area; } // Driver code int main() { float a = 5; // function calling cout << "Area of Pentagon: " << findArea(a); return 0; } Output: Area of Pentagon: 43.0119 |
|