Area of largest Circle inscribed in N-sided Regular polygon in C Program?

In geometry, finding the area of the largest circle inscribed in an N-sided regular polygon is a common problem. The inscribed circle (incircle) is the largest circle that fits entirely inside the polygon, touching all sides.

Syntax

r = a / (2 * tan(? / n))
Area = ? * r²

Where:

  • r is the radius of the inscribed circle
  • a is the side length of the polygon
  • n is the number of sides

Mathematical Derivation

A regular N-sided polygon can be divided into N equal triangles from the center. Each triangle has a central angle of 360°/N. The apothem (radius of inscribed circle) can be found using trigonometry −

r a/2 180°/n

From the triangle: tan(180°/n) = (a/2) / r

Therefore: r = a / (2 × tan(180°/n))

Example: Hexagon (6-sided polygon)

Let's calculate the area of the inscribed circle for a regular hexagon with side length 4 units −

#include <stdio.h>
#include <math.h>

int main() {
    float n = 6;    /* Number of sides (hexagon) */
    float a = 4;    /* Side length */
    float pi = 3.14159;
    
    /* Calculate radius of inscribed circle */
    float angle_rad = (pi / n);  /* Convert 180/n degrees to radians */
    float r = a / (2 * tan(angle_rad));
    
    /* Calculate area of inscribed circle */
    float area = pi * r * r;
    
    printf("Regular polygon with %g sides<br>", n);
    printf("Side length: %g units<br>", a);
    printf("Radius of inscribed circle: %.2f units<br>", r);
    printf("Area of inscribed circle: %.2f square units<br>", area);
    
    return 0;
}
Regular polygon with 6 sides
Side length: 4 units
Radius of inscribed circle: 3.46 units
Area of inscribed circle: 37.68 square units

Example: General Solution for Any N-sided Polygon

Here's a program that calculates the inscribed circle area for any regular polygon −

#include <stdio.h>
#include <math.h>

float calculateInscribedCircleArea(int n, float side_length) {
    float pi = 3.14159;
    float angle_rad = pi / n;
    float radius = side_length / (2 * tan(angle_rad));
    return pi * radius * radius;
}

int main() {
    int sides[] = {3, 4, 5, 6, 8};
    float side_length = 4.0;
    
    printf("Side length: %.1f units<br>", side_length);
    printf("Polygon\t\tArea of Inscribed Circle<br>");
    printf("-------\t\t------------------------<br>");
    
    for (int i = 0; i < 5; i++) {
        float area = calculateInscribedCircleArea(sides[i], side_length);
        printf("%d-sided\t\t%.2f square units<br>", sides[i], area);
    }
    
    return 0;
}
Side length: 4.0 units
Polygon		Area of Inscribed Circle
-------		------------------------
3-sided		3.63 square units
4-sided		12.57 square units
5-sided		21.85 square units
6-sided		37.68 square units
8-sided		76.39 square units

Key Points

  • As the number of sides increases, the inscribed circle area approaches the polygon's area
  • The formula works for any regular polygon with n ? 3 sides
  • Always convert degrees to radians when using trigonometric functions in C

Conclusion

The area of the largest inscribed circle in a regular N-sided polygon depends on both the side length and number of sides. This geometric relationship is useful in engineering and design applications where optimal space utilization is required.

Updated on: 2026-03-15T11:25:50+05:30

282 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements