The Area of a Circle = pi (rr). Where pi=3.1415 and r=Radius, Make a program that will input Radius and compute and display the Area. Your program will be terminated if input zero in the radius.
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<<"\nEnter the radius of the circle: ";
double radius;
cin>>radius;
double PI = 3.1415;
double area_of_the_circle = PI*radius*radius;
cout<<"\nThe radius of the circle = "<<radius<<endl;
cout<<"The area of the circle = "<<area_of_the_circle<<endl;
}
SAMPLE PROGRAM OUTPUT
Comments
Leave a comment