NBA - Boston Celtics

Saturday, 20 October 2012

AREA OF CIRCLE REC TRIANGLE SQUARE


#include<iostream.h>
#include<conio.h>
const float pi=3.14;
void main()
{
float cr,sa,rl,rb,areac,areas,arear;
char ch;
cout<<"press to find out area of following :\n";
cout<<"1.circle";
cout<<"\n2.rectriangle";
cout<<"\n3.square";
ch=getch();
switch(ch)
{
case'1':
cout<<"\nenter the radiusr of circle :";
cin>>cr;
areac=pi*cr*cr;
cout<<"\narea of circle is :"<<areac;
break;
case'2':
cout<<"\nenter lenth and birdth of rectriangle :";
cin>>rl>>rb;
arear=0.5*rl*rb;
cout<<"area of rectriangle is : "<<arear;
break;
case'3':
cout<<"\nenter the side of square :";
cin>>sa;
areas=sa*sa;
cout<<"\nthe area of square is : "<<areas;
break;
default:
cout<<"\nenter no. is invalid";
break;
}
}


No comments:

Post a Comment