C Program to Calculate Area and Circumference of circle


How to calculate Area and Circumference of circle in c

In this program only apply here formula of area and circumference of a circle. Firstly input here radius and then work with fix value PI use here area = PI * rad * rad; and then ci = 2 * PI * rad;Beginner C Program to find area and circumference of circle


#include<stdio.h> int main() { int rd; float pi, area, Ci; pi = 3.14; printf("\n Enter the radius of a circle: "); scanf("%d", &rd); area = pi * rd * rd; printf("\n Area of a circle is: %f ", area); Ci = 2 * pi * rd; printf("\n The Circumference is: %f ", Ci); return 0; }

Output :

Enter the radius of acircle: 3

Area of a circle is: 28.260000

The Circumference is: 18.840000

Explanation of This Program :

In this program, we are finding the circumference and area of the circle. We have the 2 formulas to find circumference and area of the circle below.

Circumference of Circle = 2 * pi * r

Area of Circle = pi * r * r
First input radius from the user then uses this following formula given below.
area = pi * rd * rd;
And CI = 2 * pi * rd;