Area of Circle in C


This program to find the area of the circle
Formula:
Area of a circle is pi * r * r
where r is a radius of a circle.
Note:use Math.PI constant to get value of pi
This programs gets the input as radius of the circle from the user and do the calculation and display the result

Example:
Radius of a circle is 5
Then Result=3.14 * 5 * 5

Output:Area of a circle is 78.53981633974483
#include <stdio.h> 
#define PI 3.14159
int main()
{
float sum=0;
float r;
printf("Enter the radius of the circle\n");
scanf("%f",&r);
sum = PI*r*r;
printf("The area of a circle is %f\n",sum);
return 0;
}


Output:
Enter radius of the circle 8
the area of a circle is 201.06192982974676