
C Program to calculate area of a circle
Algorithm
Input: Read radius from the user
output: Display the area of the circle
- Start
- Input radius
- Area = 3.14 * r * r
- Print Area
- Stop
C Program
#include <stdio.h>
#include <math.h>
int main( )
{
float r, area;
printf("Enter the radius of the circle: ");
scanf("%f", &r);
area = M_PI * pow(r, 2); //M_PI is the value of PI and pow(r,2) is r square
printf("The area of the circle with radius %f is %f", r, area);
return 0;
}
Note: This Program was created using visual studio code. The Program file can be downloaded by clicking here
Comments