Write a program in c++ to read the radius of a circles and prant its area
SOLUTION TO THE ABOVE QUESTION
SOLUTION CODE
#include<iostream>
using namespace std;
int main()
{
//propmt the user to enter the radius of the circle
cout<<"Enter the radius of the circle: ";
double radius;
cin>>radius;
//calculate the area of the circle
double area = 3.142 * radius*radius;
cout<<"\nThe area of the circle = "<<area<<endl;
return 0;
}
SAMPLE PROGRAM OUTPUT
Comments
Leave a comment