C program to calculate the surface area, volume, and space diagonal of cuboids
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 height, width, and length of cuboids from the user, and calculate the surface area, volume, and space diagonal of cuboids.
Surface area of cuboids:
A cuboid has 6 rectangular faces. To find the surface area of a cuboid, add the areas of all 6 faces. Consider that the length is l, width is w, and height is h of the prism and then the formula to calculate the Surface area of cuboids will be: 2lw + 2lh + 2hw
Volume of cuboids:
The formula to calculate volume of cuboids (V) = whl
Space diagonal of cuboids: √(l2 + b2 +h2)
Program:
The source code to calculate the surface area, volume, and space diagonal of cuboids is given below. The given program is compiled and executed using GCC compile on UBUNTU 18.04 OS successfully.
Output:
Explanation:
Here, we read the value of height, width, and length from the user. Then we calculated the surface area, volume, and space diagonal of cuboids using standard formulas.
need an explanation for this answer? contact us directly to get an explanation for this answer