Area of a circle
The area of a circle is the number of square units within the circle. To calculate the area of a circle the standard formula is: Area = Pi R Square
Area of circle = (A = πr²)
Logic
Here we have taken radius as input from the user, and to calculate the area of the circle we have to multiply the value of pi with a square of the radius.
Value of Pi = (3.14159)
Program
#include<stdio.h> int main() { float radius, area; printf("Enter radius of the circle : "); scanf("%f", &radius); area = 3.14 * (radius * radius); printf("\nArea of circle : %f" , area); return 0; }
Output
Enter radius of the circle : 25.125
Area of circle : 1982.174072
Know more about Pi? – What is Pi?