Program No 36

 

#include<stdio.h>

#include<conio.h>

//# define PI 3.14;

int volCube(int);

int volCuboid(int,int,int);

float volCone(int,int);

void main()

{

               int a,l,b,h,r,p,op,vol;

               printf("\n enter values for length of a cone ");

               scanf("%d",&a);

               printf("\n enter length,breadth,& height of a cuboid");

               scanf("%d%d%d",&l,&b,&h);

               printf("\n enter readius and height of a cone");

               scanf("%d%d",&r,&p);

              

               printf("\n select any one option to calculate volume of a particular shape at a time \n 1.volume of a cube \n 2.volume of a cuboid \n 3.volume of a cone");

               scanf("%d",&op);

               switch(op)

               {

                              case 1: printf("you have choosen to calculate volume of a cube:");

                              vol=volCube(a);

                              printf("the volume of a given cube is %d",vol);

                              break;

                              case 2:printf("you have choosen to calculate volume of a cuboid:");

                              vol=volCuboid(l,b,h);

                              printf("the volume of a given cuboid is %d",vol);

                              break;

                              case 3: printf("you have choosen to calculate volume of a cone:");

                              vol=volCone(r,p);

                              printf("the volume of a given cone is %d",vol);

                              break;

                              default:printf("you select only cube cuboid and cone shape");

                              break;

               }

}

int volCube(int a)

{

               return a*a*a;

}

int volCuboid(int l,int b,int h)

{

               return l*b*h;

}

float volCone (int r,int p)

{

               float v;

               const float PI=3.14;

               v=(PI*r*r*p)/3;

               return v;

}

 

 

              

 

 

              

Comments

Popular posts from this blog