Question #16014

write a c++ program to input choice (1 or 2 ) if choice is 1 print the area of a circle otherwise print the perimeter of a circle .accept the radius of a circle from user

Expert's answer

#include<iostream>

using namespace std;

float r;

int a;

void main(){

cout<<"enter the radius of a circle: ";

cin>>r;

cout<<"press 1 for area of a circle or 2 for perimeter of a circle: ";

cin>>a;

if (a==1) cout<<"Area of a circle is "<<3.14*r*r<<"\n";

else cout<<"Perimeter of a circle is "<<2*3.14*r<<"\n";

system("PAUSE");

}

using namespace std;

float r;

int a;

void main(){

cout<<"enter the radius of a circle: ";

cin>>r;

cout<<"press 1 for area of a circle or 2 for perimeter of a circle: ";

cin>>a;

if (a==1) cout<<"Area of a circle is "<<3.14*r*r<<"\n";

else cout<<"Perimeter of a circle is "<<2*3.14*r<<"\n";

system("PAUSE");

}

## Comments

## Leave a comment