Slip 5 - A) Write a C program to accept dimensions length (l), breadth(b) and height(h) of a cuboids and display surface area and volume (Hint : surface area=2(lb+lh+bh ), volume=lbh )

Solution:


#include <stdio.h>
int main()
{
  float length, width, height;
  float SA, Volume;

  printf("\nPlease Enter Length, Width and Height of a Cuboid\n");
  scanf("%f %f %f",&length, &width, &height);
  SA = 2 * (length * width + length * height + width * height);
  Volume = length * width * height;
  printf("\n The Surface Area of a Cuboid = %.2f\n",SA);
  printf("\n The Volume of a Cuboid = %.2f\n",Volume);
}

Post a Comment

0 Comments