Write a C++ program that inputs radius from the user and calculates area and circumference using the formula Area = πR2 and circumference = 2πR.

 #include<iostream>

using namespace std;

int main()

{

float area, radius, circle;

cout<<"Enter radius: ";

cin>>radius;

area = radius * radius * 3.141;

circle = 2.0 * 3.141 * radius;

cout<<"Area: "<<area<<endl;

cout<<"Circumference: "<<circle;

}

OUTPUT

Enter radius: 5

Area: 78.525

Circumference: 31.41

1 comment: