Before writing the program of calculating the volume of a rectangular prism in different programming languages, firstly we have to know about the rectangular prism and its volume's formula.
What is Rectangular Prism?
Rectangular Prism is a 3-D shape, which has six faces, 8 vertices, and 12 edges. This object is similar to cuboids. All the faces of this shape are rectangle.
Volume of Rectangular Prism
To calculate the volume of rectangular prism, we have to use the following formula:
Volume of Rectangular Prism = (l * w * h)
Where, h is the height of the rectangular prism
Program of calculating the volume of a rectangular prism in different Programming languages
Program 1: Write a Program in C language:
Output of Above C program:
Program 2: Write a Program in Java language:
Output of Above Java program:
Program 3: Write a Program in PHP programming language.
Output of Above PHP program:
Program 4: Write a Program in Python programming language.
Output of Above Python program: