C Program to Calculate Volume and Total Surface Area of Cuboid

Here is a C program to calculate total surface area and volume of a cuboid. A cuboid is a three dimensional object having six rectangular sides. A cuboid has twelve edges, six rectangular faces and eight vertices. This type of cuboid is also known as a rectangular cuboid or right cuboid.

Each face of a cuboid is a rectangle and angle between all three adjacent rectangular faces are 90.. Opposite faces of a cuboid are parallel and identical. The cube is a special case of the square cuboid in which all six faces are squares.

For Example : A brick is a cuboid.

Total Surface Area of Cuboid
The total surface area of cuboid is the total area on the outer side of a cuboid. In other words, we can think surface area of a cuboid as the area of wrapping paper required to gift wrap a rectangular box.
A cuboid has six rectangular surfaces of different length, width and height. Hence, to find the total surface of a cuboid first of all we should find the area of each surface of cuboid and add then to get the total surface area of cuboid. As we know, the opposite faces of a cuboid are identical, so we can use below formula to find total surface area of cuboid.
    Total Surface area of Cuboid = 2 X (LXB + LXH + BXH)
Where, L is the length of cuboid,
B is the breadth of cuboid and
H is the height of cuboid
Volume of Cuboid
The volume of a rectangular cuboid can be defined as the amount of three dimentional space occupied by the rectangular cuboid or the storage capacity of the cuboid. Volume of a cuboid is the number of cubic units that will exactly fill a cuboid. The volume of cuboid is measured in cubic units.

Finding volume of a cuboid help us to solve many real life problems like finding the capacity of a water tank which is in the form of cuboid or finding the capacity of a tin can which is in the form of cuboid.

To calculate the volume of a cube we should know the length, breadth and height of a cuboid because unlike a cube the measure of all three dimensions of cuboid may not be equal. Therefore, to find volume of the cuboid just multiply all its dimensions.
    Volume of Cuboid = L X B X H
Where, L is the length of cuboid,
B is the breadth of cuboid and
H is the height of cuboid

C Program to find total surface area and volume of a cuboid

#include <stdio.h>

int main(){
    float length, width, height, surfaceArea;
    
    printf("Enter length width and height 
        of cuboid\n");
    scanf("%f %f %f", &length, 
        &width, &height);

    surfaceArea = 2*(length*width + width*height 
       + height*length);
    printf("Total surface area of Cuboid : %0.4f\n",
        surfaceArea);
    
    return 0;
}
Output
Enter length width and height of cuboid
3 9 6
Total surface area of Cuboid : 198.0000

Above program takes length, width and height of a cuboid as input from user using scanf function and store in floating point variables 'length', 'width' and 'height' respectively. In line number 14, it calculates the total surface area of cuboid using the formula given above. Finally, it prints the surface area of cuboid on screen using printf function.


C Program to find total surface area and volume of a cuboid

#include <stdio.h>

int main(){
 float length, width, height, volume;
 
 printf("Enter length width and height 
    of cuboid\n");
 scanf("%f %f %f", &length, 
    &width, &height);

 volume = length*width*height;
 printf("Volume of Cuboid : %0.4f\n", volume);
 
 return 0;
}
Output
Enter length width and height of cuboid
3 9 6
Volume of Cuboid : 162.0000

Above program takes length, width and height of a cuboid as input from user using scanf and store in floating point variables 'length', 'width' and 'height' respectively. In line number 12, it calculates the volume of cuboid as length*width*height. Finally, it prints the volume of cuboid on screen using printf.


Properties of Cuboid
  • There are 12 edges of a cuboid, out of which 4 edges are of length L, 4 edges are of length B and remaining 4 are of length H.
  • A opposite faces of a cuboid are parallel and identical.
  • The angle between any two edge of a cuboid is 90..
  • All three faces meeting at a vertex are mutually perpendicular.
  • A cube is a special case of cuboid, where L, B and H are equal.
Where, L is the length of cuboid,
B is the breadth of cuboid and
H is the height of cuboid

Related Topics
C program to calculate volume and total surface area of cube
C program to calculate volume and total surface area of cone
C program to calculate area of a right angled triangle
C program to calculate volume and total surface area of sphere
C program to calculate volume and total surface area of cylinder
C program to calculate area of an equilateral triangle
C program to calculate area of a parallelogram
C program to calculate area of a right angled triangle
List of all C Programs