Given a cuboid of length L, breadth B and Height H, the task is to find percentage increase in the total surface area of the cuboid if length, breadth and height are increased by fixed percentages.
Examples:
Input :
L = 20, B = 30, H = 50, l = 10 %, b = 12 %, h = 15 %
Output :
26.97 %
Input :
L = 40, B = 60, H = 15, l = 5 %, b = 7 %, h = 12 %
Output :
14.88 %
Code : Python code to find the increase in the total surface area of the cuboid.
Python3
def increaseIntsa(L, B, H, l, b, h):
oldsurfacearea = 2 * ((L * B) + (L * H) + (B * H))
newsurfacearea = 2 * ((L + (L * l * 0.01 )) * (B + (B * b * 0.01 )) +
(L + (L * l * 0.01 )) * (H + (H * h * 0.01 )) +
(B + (B * b * 0.01 )) * (H + (H * h * 0.01 )))
increase = (newsurfacearea - oldsurfacearea)
increasepercent = (increase / oldsurfacearea) * 100
return (increasepercent)
L = 20
B = 30
H = 50
l = 10
b = 12
h = 15
print (increaseIntsa(L, B, H, l, b, h), "%" )
|
Output :
26.974193548387092 %
Time Complexity: O(1)
Auxiliary Space: O(1)
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!
Last Updated :
18 Mar, 2022
Like Article
Save Article