A Program to Find the Area of a Circle
In this example, we are giving a program to find the area of a circle. The rule of finding the area of a circle is: A = πr2.
Program to find the area of a circle:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main() {
float pie, r, area;
pie = 3.14;
printf("Enter the value of radius: ");
scanf("%f",&r);
area = 3.14 * pow(r,2);
printf("Area of circle: %.2f", area);
return 0;
}
Output:
Enter the value of radius: 3 Area of circle: 28.26