Saturday 29 April 2023

Exercise 1-To demonstrate the use of data types, simple operators and expressions - 6

 6. Accept three dimensions length (l), breadth(b) and height(h) of a cuboid and print surface

area and volume (Hint : surface area=2(lb+lh+bh ), volume = lbh )
 

#include<stdio.h>
#include<conio.h>

void main()
{
 int l,b,h;
 float sa,v;
 clrscr();

 printf("\nFinding the surfacearea and volume of cubiod:");
 printf("\nEnter the lenght of cubiod:");
 scanf("%d",&l);
 printf("\nenter the  breath of cubiod:");
 scanf("%d",&b);
 printf("\nEnter the height of cubiod:");
 scanf("%d",&h);

 sa=2*(l*b+l*h+b*h);
 printf("\nSurface area of cubiod is:%f",sa);

 v=l*b*h;
 printf("\nVolume of cubiod is:%f",v);

 getch();
}

/*

Finding the surfacearea and volume of cubiod:                                  
Enter the lenght of cubiod:5                                                   
                                                                               
enter the  breath of cubiod:4                                                  
                                                                               
Enter the height of cubiod:6                                                   
                                                                               
Surface area of cubiod is:148.000000                                           
Volume of cubiod is:120.000000                                                 
*/
 

No comments:

Post a Comment

Questions

  Exercise 1 Set A . Apply all the three program development steps for the following examples.  1. Accept dimensions of a cylinder and p...