
- 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 a n-sided regular polygon with given Radius 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*r2*sin(2t)/2 = n*r2*sin(360/n)/2
Example
#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; }
Output
area = 47.999962
- Related Articles
- Area of a n-sided regular polygon with given Radius?
- Area of a n-sided regular polygon with given side length in C++
- Area of largest Circle inscribe in N-sided Regular polygon in C Program?
- Area of largest Circle inscribed in N-sided Regular polygon in C Program?
- Apothem of a n-sided regular polygon in C++
- Determine the position of the third person on regular N sided polygon in C++ Program
- Area of a polygon with given n ordered vertices in C++
- 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++
- Program to find the Circumcircle of any regular polygon in C++
- Program to find area of a polygon in Python
- Program to find the Interior and Exterior Angle of a Regular Polygon in C++
- Area of hexagon with given diagonal length in C Program?
- C Program for area of hexagon with given diagonal length?

Advertisements