C Program to Find the Area of a Semicircle

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

  • Semicircle Perimeter. = 3.14 * radius
  • Semicircle 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 C 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 Semicircle Radius = ");
    scanf("%f",&clRadius);

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

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