Académique Documents
Professionnel Documents
Culture Documents
h> int main() { int a,b,c,i,base,height; float area,s; clrscr(); cout<<"enter 1 for base & height and 2 for 3 sides"; cin>>i; switch(i) { case 1 : { cout<<"enter the values of base and height"; cin>>base>>height; area=(0.5)*base*height; cout<<"area="<<area; break; } case 2: { cout<<"enter three sides"; cin>>a>>b>>c; s=(a+b+c)/2; area=sqrt(s*(s-a)*(s-b)*(s-c)); cout<<"s="<<s<<endl<<"area="<<area; break; } } getch(); } output: enter 1 for base & height and 2 for 3 sides 1 enter the values of base and height 44 66 area=1452 enter 1 for base & height and 2 for 3 sides 2 enter three sides 44 66 88 s=99 area=1405.892955