- HubPages»
- Technology»
- Computers & Software»
- Computer Science & Programming
C Program to Find Circle's Area and Circumference
This tutorial will provide the source code of C Program to find the area and circumference of a circle provided we know the diameter or radius of a circle. If we are given Diameter of a circle, then we need to divide it by 2 so that we get the value of radius of circle as most of the calculations we do require radius.
The Formula for calculation of Area of Circle is :
Area of Circle = PI * R * R
While Formula for calculation of Circumference of Circle is :
Circumference of Circle = 2 * PI * R
We have already defined Pi as Floating type variable whose value is fixed as 3.14 for the calculation purposes.
C Program Source Code to Find Area and Circumference of a Circle
#include<stdio.h> int main() { int radius; float PI=3.14,area,cirf; printf("nEnter the radius of circle: "); scanf("%d",&radius); area = PI * radius * radius; printf("nArea of circle : %f ",area); cirf = 2 * PI * radius; printf("nCircumference : %f ",cirf); return(0); }
Like the article, Rate it now !
Output of Program :
Enter radius of a circle : 1 Area of circle : 3.14 Circumference : 6.28