C Program - Calculate surface area and volume of a three dimensions cuboid - IProgramX

Q. Accept three dimensions length (l), breath (b) and height (h) of a cuboid and print surface area and volume 



Program

#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);
}

Output:

Please Enter Length, Width and Height of a Cuboid
5 7 3

 The Surface Area of a Cuboid = 142.00

 The Volume of a Cuboid = 105.00

Post a Comment

0 Comments