Howdy readers, today you will learn **how to find the volume of a cuboid using the C** Programming language.

A **cuboid** is a three-dimensional shape that has **6** faces, **12** edges, and **8** vertices. It is different from a cube since all the faces of a cuboid are rectangular in shape, whereas a cube has square faces.

To calculate the volume of a cuboid we find the product of its length, breadth and height. It is given by the formula:

**Volume = Length x Breadth x Height**

You can use any of the following methods to find the volume of a cuboid:

- Using Standard Method
- Using User-defined Functions

So, without any delay, letâ€™s begin this tutorial.

**C Program to Find Volume of Cuboid**

**C Program**

// C Program to Find the Volume of a Cuboid #include <stdio.h> int main(){ float length, breadth, height; float vol; // Taking input printf("Enter the length: "); scanf("%f", &length); printf("Enter the breadth: "); scanf("%f", &breadth); printf("Enter the height: "); scanf("%f", &height); // Computing volume vol = length * breadth * height; // Display result printf("The volume of the cuboid is: %.2f", vol); return 0; }

**Output**

Enter the length: 9 Enter the breadth: 6 Enter the height: 15 The volume of the cuboid is: 810.00

**Explanation**

// Computing volume vol = length * breadth * height;

The volume of the cuboid is calculated using the mathematical formula: **Volume of Cuboid = Length x Breadth x Height**.

The volume gets stored in the ** vol** named variable.

printf("The volume of the cuboid is: %.2f", vol);

The volume of the cuboid is printed on the screen with the help of the ** printf()** function. The

**format specifier is used to limit the value of volume to**

`%.2f`

**2**decimal places.

**C Program to Find Volume of Cuboid Using Function**

**C Program**

// C Program to Find Volume of Cuboid Using Function #include <stdio.h> // Defining function float volume(float l, float b, float h){ return (l * b * h); } int main(){ float length, breadth, height; float vol; // Taking input printf("Enter the length of the cuboid: "); scanf("%f", &length); printf("Enter the breadth of the cuboid: "); scanf("%f", &breadth); printf("Enter the height of the cuboid: "); scanf("%f", &height); // Calling out function vol = volume(length, breadth, height); // Display result printf("The volume of the cuboid is: %.2f", vol); return 0; }

**Output**

Enter the length of the cuboid: 2 Enter the breadth of the cuboid: 4 Enter the height of the cuboid: 6 The volume of the cuboid is: 48.00

**Explanation**

float volume(float l, float b, float h){ return (l * b * h); }

We have defined a user-defined function named ** volume** which passes the dimensions of the cuboid as arguments and returns the volume of the cuboid.

// Calling out function vol = volume(length, breadth, height);

Then, this function is called out in the **main function** which gives the value of the volume. The returned value gets stored in the ** vol** named variable.

**Conclusion**

Today you learned **how to find the volume of a cuboid in the C **Programming language.

You can use any of the approaches to find the volume of the cuboid. The standard method sounds more simple and easy to me. Let me know which one you like more.

Feel free to ask your doubts in the comment section.

Thanks for reading.

Happy coding!!

**Also Read:**

**C Program to Find Volume of Cylinder****C Program to Find Perimeter of Rectangle****C Program to Calculate Cube of a Number****C Program to Draw Rectangle Using For Loop****C Program to Find Volume and Surface Area of a Cone**