**Ex:**write a C program to find Area of the circle. How to write a C program to find area of circle. C program to find area of circle.

**Input from user:**

Enter the radius of the circle: 5

**Expected Output:**

**Area of circle is: 78.500000**

__To find area of circle we need to use__

**pi(π)**. Because**pi(π)**represents**the ratio of the circumference of a circle to its diameter.****Step by step logic of the program:**

**1. First we need to declare two variable's. One for accepting radius of the circle from user and second one is for store the area of circle.**

2. So declare variable's

**r**for radius of the circle and

**a**for area of the circle.

3. To find area use area of circle's simple logic which π*r^2(pi r square).

4. Here pi's value is 3.14. so we will write a=3.14*r*r.(here r=5)

5. Last we will print value of

**a**(area of circle) on the output screen.

**Program:**

**#include<stdio.h>**

int main()

{

int r;

float a;

printf("enter the radius of the circle:\n");

scanf("%d",&r);

a=3.14*r*r;

printf("Area of circle is %f",a);

return 0;

}

**Above program shows the following output:**

## 0 comments:

## Post a Comment

If you have any doubts, please discuss here...