C Program to find area and circumference of circle
Learn C - C tutorial - c program to find area and circumference of circle - C examples - C programs
C Program to find area and circumference of circle
- This program accepts one value(float value) from user and stores it into radius parameter.
- In this program we have to calculate the area and circumference of the circle. We have following 2 formulas for finding circumference and area of circle.
- Area of circle = PI * R * R
- Circumference of Circle = PI * R * 2
Sample Code
#include<stdio.h>
int main()
{
int radius;
float PI = 3.14, area, circumference;
printf("\nEnter radius of circle: ");
scanf("%d", & radius);
area = PI * radius * radius;
printf("\nArea of circle : %f ", area);
circumference = 2 * PI * radius;
printf("\nCircumference : %f ", circumference);
return (0);
}
Output
Enter radius of circle: 5
Area of circle : 78.500000
Circumference : 31.400002