professor chang wants a program that caculates and displays the are of a circle, given the circle's radius. the formula for calculating the area of a circle is πr^2, where π and r represents pi and the radius, respectively. the professor wants to use the value of pi reounded to two decimal places, which is 3.14
#include<iostream>
using namespace std;
int main(){
int radius;
double pi = 3.14;
cout<<"Enter the radius of the circle\n";
cin>>radius;
cout<<"\nThe area of the circle is: "<<pi * radius * radius;
}
Comments
Leave a comment