pls tell the c++ program to find the area of a circle
Answers
Explanation:
//C++ program to calculate area of the circle
#include <iostream>
using namespace std;
int main() {
float radius, area_circle;
// take radius as input
cout << "Enter the radius of circle: ";
cin >> radius;
area_circle = 3.14 * radius * radius;
cout << "Area of circle: " << area_circle << endl;
return 0;
}
Output
Enter the radius of circle: 5
Area of circle: 78.5
Example: C++ program to find area of the circle using function.
//C++ program to find area of the circle using function
#include <iostream>
using namespace std;
//function declaration
float areaOfCircle(float radius_circle);
int main() {
float radius;
// take radius as input
cout << "Enter the radius of circle: ";
cin >> radius;
cout << "Area of circle: " << areaOfCircle(radius) << endl;
return 0;
}
// function definition to calculate area of circle
float areaOfCircle(float radius_circle)
{
float area_circle;
area_circle = 3.14 * radius_circle * radius_circle;
return area_circle; //return area
}
Output
C++ program area of circle
Explanation
In the first program, we have simply calculated area of the circle in the main program.
However, we have used areaOfCircle( ) function for calculating area of the circle in the second program.
happy birthdy bro ☺️
wish ur dreams become true☺️
always be happy
☺️
have a nice journey
☺️
live ur life happily each and everyone second
always u r my bro ☺️
love u always bro !!!
enjoy this special day with ur level best
shine like a sun
be like a moon
may u win this world one day
bye bro
happy long life to u
love u bro ❤️❤️❤️❤️❣️❣️❣️❣️
by
YUVI