Cpp program for area
of circle
Hello friends, in this blog we see the cpp program for
finding the area of the circle. To find the area of the circle we must know the formula
for calculating the area of circle i.e. area = pi * radius * radius
In this formula, the value of pi is in float i.e. 3.14, so we are using float
datatype. By using the following program
we find the area of the circle.
C language code for Area of Circle:
#include<iostream.h>
#include<conio.h>
void main()
{
float radius,
area;/* to accept floating number*/
cout<<"\nEnter the radius of Circle : ";
//take input from
the user
cin>>radius;
/* to store the floating number,
area = 3.14 *
radius * radius;
// formula and answer store in area variable
cout<<"\nArea of Circle :"<<area; // display answer
getch();
}
_____________________________________________________________
Output:
Enter the radius of Circle:3
Area of Circle:28.26
Enter the radius of Circle:9.54
Area of circle in Cpp language
Reviewed by Amit Waghmare
on
November 02, 2019
Rating:
No comments: