Python Program to find volume, surface area and space diagonal of a cuboid
Last Updated :
14 Aug, 2022
Given the length, base, and height of a cuboid. The task is to find the Surface Area, Volume and space diagonal of the cuboid.
Examples:
Input :
length = 9
breadth = 6
height = 10
Output :
Surface area = 408
volume = 540
space diagonal = 14.73
Input :
length = 5
breadth = 4
height = 3
Output :
surface area = 94
volume = 60
space diagonal = 7.07
Formulae Used:
- Surface Area =
- Volume =
- Space diagonal =
Below is the implementation.
Python3
import math
def find_surafce_area(l, b, h):
Surface_area = 2 * ( l * b + b * h + h * l)
print (Surface_area)
def find_volume(l, b, h):
Volume = (l * b * h)
print (Volume)
categories Most Used
School Programming
Aptitude
Re
def find_space_diagonal(l, b, h):
Space_diagonal = math.sqrt(l * * 2 + b * * 2 + h * * 2 )
print (Space_diagonal)
l = 9
b = 6
h = 10
find_surafce_area(l, b, h)
find_volume(l, b, h)
find_space_diagonal(l, b, h)
|
Output:
408
540
14.730919862656235
Time Complexity: O(logn)
Auxiliary Space: O(1)
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...