Program
#include<stdio.h>
int main()
{
int ch;
float radius, area,ci,volume;
printf("1.area of circle\n2.circumference of circle\n3.volume of sphere\n");
printf("enter your choice : ");
scanf("%d",&ch);
switch(ch)
{
case 1:
printf("\nEnter the radius of Circle : ");
scanf("%f", &radius);
area = 3.14 * radius * radius;
printf("\nArea of Circle : %f", area);
break;
case 2:
printf("\nEnter the radius of Circle : ");
scanf("%f", &radius);
ci = 2 * 3.14 * radius;
printf("\nCircumference : %f ", ci);
break;
case 3:
printf("Enter radius of the sphere : \n");
scanf("%f", &radius);
volume = (4.0/3) * (3.14) * radius * radius * radius;
printf("\n Volume of sphere is : %f", volume);
break;
default: printf ("\n Invalid entry");
}
}
Output:
1.area of circle
2.circumference of circle
3.volume of sphere
enter your choice : 2
Enter the radius of Circle : 6
Circumference : 37.680000
0 Comments