# Area of decagon inscribed within the circle in C Program?

CServer Side ProgrammingProgramming

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
Published on 09-Aug-2019 10:13:58
Advertisements