#include
void main(){
int fig_code;
float side, base, length, breadth, height, area, radius;
printf("-------------------------
");
printf(" 1 --> Circle
");
printf(" 2 --> Rectangle
");
printf(" 3 --> Triangle
");
printf(" 4 --> Square
");
printf("-------------------------
");
printf("Enter the Figure code
");
scanf("%d", &fig_code);
switch(fig_code){
case 1:
printf(" Enter the radius
");
scanf("%f",&radius);
area=3.142*radius*radius;
printf("Area of a circle=%f
", area);
break;
case 2:
printf(" Enter the breadth and length
");
scanf("%f %f",&breadth, &length);
area=breadth *length;
printf("Area of a Rectangle=%f
", area);
break;
case 3:
printf(" Enter the base and height
");
scanf("%f %f", &base, &height);
area=0.5 *base*height;
printf("Area of a Triangle=%f
", area);
break;
case 4:
printf(" Enter the side
");
scanf("%f", &side);
area=side * side;
printf("Area of a Square=%f
", area);
break;
default:
printf(" Error in figure code
");
break;
}
}