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"); }
Comments
Leave a comment