
- 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?
Here we will see how to get the area of an n-sided regular polygon whose radius is given. Here the radius is the distance from the center of any vertex. To solve this problem, we have drawn one perpendicular from the center to one side. Let each side is of length ‘a’. The perpendicular is dividing the side into two parts. The length of each part is a/2. The perpendicular and one radius is making an angle x. Let the length of the radius is h.
Here we can see that the polygon is divided into N equal triangles. So for any polygon with N sides, will be divided into N triangles. So the angle at the center is 360. That is divided into 360°/N different angles (Here 360°/6 = 60°). So the angle x is 180°/N. Now we can easily get the h and a using trigonometric equations.
Now the area of whole polygon is N*A.
Example
#include <iostream> #include <cmath> using namespace std; float polygonArea(float r, int n){ return ((r * r * n) * sin((360 / n) * 3.1415 / 180)) / 2; //convert angle to rad then calculate } int main() { float rad = 9.0f; int sides = 6; cout << "Polygon Area: " << polygonArea(rad, sides); }
Output
Polygon Area: 210.44
- Related Articles
- 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 largest Circle inscribe in N-sided Regular polygon in C Program?
- Area of largest Circle inscribed in N-sided Regular 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++?
- Determine the position of the third person on regular N sided polygon in C++ Program
- 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++
- What is regular polygon ?
- What is a regular polygon?State the name of a regular polygon of(i) 3 sides(ii) 4 sides(iii) 6 sides.
- Check if it is possible to create a polygon with given n sidess in Python
- The interior angle of a regular polygon is $156$ . Find the number of sides of the polygon.
- Program to find area of a polygon in Python
