C Program to calculate area of Circle, if Radius is given | Area of Circle program in C language
Description:
This program accepts one value(float value) from user and stores it into radius parameter. Then it will calculate the Area of Circle based on that radius.
Formula for Area of Circle:
Here is the formula to calculate the area of Circle.
Area = π × r2
The area of a circle is π (Pi) times the Radius squared. Where π (Pi) is 22/7 or 3.142.
Program :
-
#include <stdio.h>
-
#include <math.h>
-
#define PI 3.142
-
-
void main()
-
{
-
float radius, area;
-
printf(“Enter the radius of a circle : “);
-
scanf(“%f”, &radius);
-
area = PI * pow(radius, 2);
-
printf(“Area of a circle = %5.2fn“, area);
-
}
2 Responses
[…] C Program to Calculate Area of Circle […]
[…] C Program to Calculate Area of Circle […]