Skip to content
Home » C Program to Find Volume of a Rectangular Box

C Program to Find Volume of a Rectangular Box

Learn about C Program to Find Volume of a Rectangular Box in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

C Program to Find Volume of a Rectangular Box

A rectangle’s volume equals its length * width * height. If the box is a rectangular prism or a cube, the only information we require is its length, width, and height. We may then multiply them together to get volume. This formula is sometimes shortened as V = lwh.

Program:

#include<stdio.h>
int main()
{
  double len, wid, height, volume;

  printf("Enter length, width, and height: ");
  scanf("%lf %lf %lf",&len, &wid, &height);

  volume = len * wid * height;
  printf("Volume=%.2f", volume);

  return 0;
}

Output:

Enter length, width, and height: 2 3 4
Volume=24.00

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Codes :
C Program to Find the Volume of a Cube Using pow() Function
C Program to Find the Volume of a Cube