C Program to Find the Area of a Semicircle

Write a C program to find the area of a semicircle. This example allows entering the semicircle radius and uses it to calculate the area.

  • Perimeter = 3.14 * radius
  • Area = 1/2πr²
#include <stdio.h>

int main()
{
    float clRadius, clArea, clPerimeter;
    
    printf("Enter the Semicircle Radius = ");
    scanf("%f",&clRadius);

    clPerimeter = 3.14 * clRadius;
    
    clArea = 0.5 * 3.14 * (clRadius * clRadius);

    printf("The Perimeter of a Semicircle = %.2f\n", clPerimeter);
    printf("The Area of a Semicircle = %.2f\n", clArea); 
    
    return 0;
}
C Program to Find the Area of a Semicircle

In this program, circleArea and circlePerimeter functions accept radius and find the perimeter and area of a semicircle.

#include <stdio.h>

float circleArea(float clRadius)
{
    return 0.5 * 3.14 * (clRadius * clRadius);
}

float circlePerimeter(float clRadius)
{
    return 3.14 * clRadius;
}

int main()
{
    float clRadius, clArea, clPerimeter;
    
    printf("Enter the Radius = ");
    scanf("%f",&clRadius);

    clPerimeter = circlePerimeter(clRadius);
    
    clArea = circleArea(clRadius);

    printf("The Perimeter = %.2f\n", clPerimeter);
    printf("The Area = %.2f\n", clArea); 
    
    return 0;
}
Enter the Radius = 12
The Perimeter = 37.68
The Area = 226.08

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.