#include<stdio.h>
#include<conio.h>
int main()
{
int n;
float rad,area,nsq,length,breadth;
printf("enter any number\n");
scanf("%d",&n);
switch(n)
{
case 1:
printf("\nplease enter the radius of the circle\n");
scanf("%f",&rad);
area=3.14*rad*rad;
printf("\nArea of circle: %f",area);
break;
case 2:
printf("please enter the lenght of side of the square:");
scanf("%f",&nsq);
area=nsq*nsq;
printf("\nArea of rectangle: %f",area);
break;
case 3:
printf("please enter the lenght of the rectangle:");
scanf("%f",&length);
printf("enter the breadth of the rectangle:");
scanf("%f",&breadth);
area=length*breadth;
printf("\nArea of rectangle: %f",area);
break;
default:
printf("invalid choice");
}
}
Output:
enter any number
1
please enter the radius of the circle
3
Area of circle: 28.260000
enter any number
2
please enter the lenght of side of the square:4
Area of rectangle: 16.000000
enter any number
3
please enter the lenght of the rectangle:4
enter the breadth of the rectangle:3
Area of rectangle: 12.000000
Program:
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer