C program to calculate the volume of Cube
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Read the length of the side of the Cube from the user, and calculate the volume of the Cube.
Volume of Cube formula: side3 or a3
Where, side (or a) is the length of the side (i.e., edge)
Program:
The source code to calculate the volume of Cube is given below. The given program is compiled and executed using GCC compile on UBUNTU 18.04 OS successfully.
Output:
Explanation:
In the above program, we created two functions calcuateVolumeOfCube() and main(). The calcuateVolumeOfCube() function is used to calculate the volume of Cube based on the given side of Cube.
In the main() function, we read the value of the side of Cube from the user. Then we called the calcuateVolumeOfCube() function to calculate the volume of the Cube. After that, we printed the result on the console screen.