Answer to Question #16014 in C++ for anika

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
1
Expert's answer
2012-10-10T11:14:13-0400
#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");
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS