Google Add

Search

Program to Calculate Area of Circle

Write a program to calculate area of a circle.  To calculate the area of a circle use the Mathematical formula define below.

Area of Circle is :   π × r2 

Where r is the radius of the circle and the value of PI is 3.14 (22/7). 

Let's say someone input the value of radius of circle (r) is 3.

Area of circle is : 3.14 * 3 * 3
                          :28.27


C Program to Calculate Simple Interest.


Print factors of a number.

Program to Calculate Area of Circle


#include <stdio.h>
int main()
{
 int radius;

/* Declare PI and area as float datatype. */

 float PI=3.14,area;

/* Take radius of a circle as a input from user. */

 printf("\n Enter radius of a circle: ");
 scanf("%d",&radius);

 /* Area of circle */

 area = PI * radius * radius;

 printf("\nArea of circle is : %f ",area);


  return(0);
}

Output: 

Enter radius of a circle: 3

Area of circle is : 28.260001

No comments:

Post a Comment