- 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?

An n-sided regular polygon inscribed in a circle, the radius of this circle is given by the formula,

r = a/(2*tan(180/n))

Suppose a polygon have 6 faces i.e., a hexagon and as we know mathematically that the angle is 30 degree

So the radius of circle will be (a / (2*tan(30)))

Therefore, r = a√3/2

We see the polygon can be divided into N equal triangles. Looking into one of the triangles, we see that the whole angle at the center can be divided into = 360/N

So, angle x = 180/n Now, tan(x) = (a / 2) * r So, r = a / ( 2 * tan(x)) So, Area of the Inscribed Circle is, A = Πr2 = Π * (a / (2 * tan(x))) * (a / (2*tan(x)))

#include <iostream> using namespace std; int main() { float area; float n = 6; float a = 4; float r = a / (2 * tan((180 / n) * 3.14159 / 180)); area = (3.14) * (r) * (r); cout <<”area = ”<<area<< endl; return 0; }

area = 37.6801

Advertisements