#include<stdio.h>
#include<conio.h>
int main()
{
float l,b,h,r,area;
int choice;
clrscr();
printf("enter the choice to calculate area");
printf("\n1.Triangle\n2.Rectangle\n3.square\n4.circle");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("\nenter the base and height");
scanf("%f%f",&b,&h);
area=b*h*0.5;
printf("\nthe area is %f",area);
break;
case 2:
printf("\nenter the length and breadth");
scanf("%f%f",&l,&b);
area=l*b;
printf("\nthe area is %f",area);
break;
case 3:
printf("\nenter the side");
scanf("%f",&l);
area=l*l;
printf("\nthe area is %f",area);
break;
case 4:
printf("\nenter the radius");
scanf("%f",&r);
area=r*r*3.14;
printf("\nthe area is %f",area);
}
getch();
return 0;
}
0 comments:
Post a Comment