- 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
Area of decagon inscribed within the circle in C Program?
A regular decagon is a ten sided polygon with all sides and angles equal. And here we need to find the area of a decagon that is inscribed inside a circle using the radius of the circle r,
Mathematical formula for the side of the decagon inscribed in the circle,
a = r√(2-2cos36o)
(Using cosine rules)
Formula for finding area of decagon,
Area = 5*a2*(√5+2√5)/2 Area = 5 *(r√(2-2cos36))^2*(√5+2√5)/2 Area = (5r2*(3-√5)*(√5+2√5))/4
Using this formula in a program,
Example
#include <stdio.h> #include <math.h> int main() { float r = 8; float area = (5 * pow(r, 2) * (3 - sqrt(5))* (sqrt(5) + (2 * sqrt(5))))/ 4; printf("area = %f",area); return 0; }
Output
area = 409.968933
Advertisements