
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
Area of largest Circle inscribe in N-sided Regular polygon in C Program?
Here we will see how to get the area of the circle which is inscribed in N-sided regular polygon. The N (number of sides) are given, and each side of the polygon is ‘a’
The approach is simple. One N sided polygon can be divided into N equal triangles, the whole angle for each triangle in center is 360/N, so −
Example
#include <iostream> #include <cmath> using namespace std; float area(float n, float a) { if (n < 0 || a < 0 ) //if the valuse are negative it is invalid return -1; float r = a/(2.0*tan((180/n) * 3.14159/180)); float area = 3.14159 * r*r; return area; } int main() { float n = 8, a = 4; cout << "Area : " << area(n, a); }
Output
Area : 73.2422
- Related Articles
- Area of largest Circle inscribed in N-sided Regular polygon in C Program?
- Area of a n-sided regular polygon with given Radius in C Program?
- Area of a n-sided regular polygon with given side length in C++
- Apothem of a n-sided regular polygon in C++
- Area of a n-sided regular polygon with given Radius?
- Determine the position of the third person on regular N sided polygon in C++ Program
- Determine the position of the third person on regular N sided polygon in C++?
- Find number of diagonals in n sided convex polygon in C++
- Probability that the pieces of a broken stick form a n sided polygon in C++
- Find the area of largest circle inscribed in ellipse in C++
- Program to find the Circumcircle of any regular polygon in C++
- C program to print area of triangle, square, circle, rectangle and polygon using switch case.
- Area of a polygon with given n ordered vertices in C++
- Area of a circle inscribed in a regular hexagon?
- Area of circle inscribed within rhombus in C Program?

Advertisements