C++ program to find area of circle using function
#include<iostream>
using namespace std;
float area_circle(int radius);
int main()
{
float radius,area;
cout<<"Enter the radius of the circle to find the area\n";
cin>>radius;
area=area_circle(radius);
cout<<"Area of the circle is \n"<<area;
}
float area_circle (int radius)
{
float area;
area=3.14*radius*radius;
return area;
}
using namespace std;
float area_circle(int radius);
int main()
{
float radius,area;
cout<<"Enter the radius of the circle to find the area\n";
cin>>radius;
area=area_circle(radius);
cout<<"Area of the circle is \n"<<area;
}
float area_circle (int radius)
{
float area;
area=3.14*radius*radius;
return area;
}
OUTPUT:
Enter the radius of the circle to find the area
2
Area of the circle is
12.56
Comments
Post a Comment