C Language program to calculate circle area

Views: 14   

Following program shows you how to calculate circle area.
In this tutorial will get circle radius from user and calculate area and prints it using following formula
Area = PI X r X r

#include <stdio.h>

int main(void) {
    float circleRadius;

    printf("Please enter the radius of circle:");
    scanf("%f", &circleRadius);

    float areaOfCircle = 22 / 7 * (circleRadius * circleRadius);

    printf("Area of circle is: %f", areaOfCircle);
}

Output:

Please enter the radius of circle: 8
Area of circle is: 192.000000
On By