- Related Questions & Answers
- C Program for Tower of Hanoi
- C++ Program for Dijkstra’s shortest path algorithm?
- C/C++ Program for nth Catalan Number?
- C Program to Multiply two Floating Point Numbers?
- C program to find the length of a string?
- C Program to Check if all digits of a number divide it
- C Program to Check if a Given String is a Palindrome?
- Write a program to Delete a Tree in C programming
- Write a C program to print “ Tutorials Point ” without using a semicolon
- Surface Area and Volume of Hexagonal Prism in C programming
- Sum of the nodes of a Singly Linked List in C Program
- Sum of first n natural numbers in C Program
- C Program for simple interest?
- Area of a n-sided regular polygon with given Radius in C Program?
- Area of a leaf inside a square in C Program?

A polygon is a ‘n’ sided closed figure.N sided polygon means a polygon with n equal sides. The radius of a polygon is distance between center and vertex.

In the figure we can see that the whole polygon can be divided into n equal polygon

We know,

area of the triangle = (base * height)/2

Area of the small triangle using trigonometric logic,

area = r2*sin(t)cos(t) = (r2*sin(2t))/2

So, area of the polygon:

Area = n * (area of one triangle)

= n*r^{2}*sin(2t)/2 = n*r^{2}*sin(360/n)/2

#include <stdio.h> #include <math.h> int main() { float r = 4 n = 12; float area = ((r * r * n) * sin((360 / n) * 3.14159 / 180)) / 2; printf("area = %f", area); return 0; }

area = 47.999962

Advertisements