program
11:Accept radius from the user write a
program having menu driven with the following options and corresponding actions
.
1. Area of circle : compute area of circle and print.
2. Circumference of
circle :compute circumference of circle.
3. Volume of sphere : compute volume of sphere.
#include<stdio.h>
void main()
{
float
a,cir,v,r,PI=3.14;
int choice;
printf("\nEnter radius:");
scanf("%f",&r);
printf("\n1:Area
of circle");
printf("\n2:Circumference
of circle");
printf("\n3:Volume
of sphere");
printf("\nEnter
your choice:");
scanf("%d",&choice);
switch(choice)
{
case 1:
a=PI*r*r;
printf("\nArea
is %f",a);
break;
cir=PI*2*r;
printf("\nCircumference
is %f",cir);
break;
case 3:
v=4/3*PI*r*r*r;
printf("\nVolume
is %f",a);
break;
default:
printf("\n invalid");
}
}
Output
[root@localhost Desktop]# gcc nnn.c
[root@localhost Desktop]# ./a.out
Enter radius: 2
1:Area of circle
2:Circumference of circle
3:Volume of sphere
Enter your choice:1
Area is 12.560000.
0 coment�rios: