- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C Program for area of decagon inscribed within the circle?
Here we will see how to get the area of decagon which is present inside the circle. The radius is given. The side of the decagon is ‘a’.
As we know that the side of the decagon is like below −
So the area is −
Example
#include <iostream> #include <cmath> using namespace std; float area(float r) { if (r < 0) //if r is negative it is invalid return -1; float area = (5 * pow(r, 2) * (3 - sqrt(5)) * (sqrt(5) + (2 * sqrt(5)))) / 4; return area; } int main() { float r = 8; cout << "Area : " << area(r); }
Output
Area : 409.969
Advertisements