Find out the Area of circle by user input in c Programming.
Find out the Area of circle by user input in c Programming.
Theory : First we have to take a variable r in data
type int or float as your wish .Now you have to set a veriable in data type float (pi=3.1416), and you take
a float type variable name area
.Now you have to take input form user by using (
printf("Enter the value of r :");
scanf("%d",&r);
)
After doing this things you hae to apply the theory of
area of circle (area =pi*r*r). after that print the area veriable.
Source code :
#include<stdio.h>
int main()
{
int r;
float area
,pi=3.1416;
printf("Enter the value of r :");
scanf("%d",&r);
area
=pi*r*r;
printf("Area of circle is =%f",area);
return 0;
}
Output :
Enter the value of r :5
Area of circle is =78.540001
No comments