Learn Online Program
Today Use Tomarrow Use

C/C++ » C Program


Table of Content

C Program to find area and circumference of circle

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include<stdio.h> 
int main() {
   int rad;  float PI = 3.14, area, ci;  
 printf("\nEnter radius of circle: ");
  scanf("%d", &rad);   
area = PI * rad * rad;  printf("\nArea of circle : %f ", area); 
  ci = 2 * PI * rad; 
 printf("\nCircumference : %f ", ci);
   return (0);}

Output :

1
2
3
Enter radius of a circle : 1Area of circle : 3.14Circumference : 6.28

Explanation of Program :

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.

1
Area of Circle = PI * R * R

and

1
Circumference of Circle = 2 * PI * R

In the above program we have declared the floating point variable PI whose value is defaulted to 3.14.We are accepting the radius from user.

1
2
printf("\nEnter radius of circle: ");scanf("%d", &rad);


Table of Content

C Program to Calculate Area and Circumference of circle

2014-08-02T18:35:43+00:00
(adsbygoogle = window.adsbygoogle || []).push({});

C Program to find area and circumference of circle

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include<stdio.h> 


   int rad;  float PI = 3.14, area, ci; 
  printf("\nEnter radius of circle: ");
  scanf("%d", &rad);
   area = PI * rad * rad;
  printf("\nArea of circle : %f ", area);
   ci = 2 * PI * rad;
  printf("\nCircumference : %f ", ci);
   return (0);}

Output :

1
2
3
Enter radius of a circle : 1Area of circle : 3.14Circumference : 6.28

Explanation of Program :

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.

1
Area of Circle = PI * R * R

and

1
Circumference of Circle = 2 * PI * R

In the above program we have declared the floating point variable PI whose value is defaulted to 3.14.We are accepting the radius from user.

1
2
printf("\nEnter radius of circle: ");scanf("%d", &rad);


rss feed widget