Sunday, September 28, 2025

Python Program Collection 03 - to display tsa, volume of sphere, hemisphere, cylinder, cuboid, cube

 


28. Display total surface area of sphere.

pi = 3.1416

r = float(input("Enter the radius of the sphere: "))

area = 4 * pi * r ** 2

print(f"The total surface area of the sphere with radius {r} is: {area:.2f}")

 

 

 

 

29. Display volume of sphere.

r = float(input("Enter the radius of the sphere: "))

pi = 3.1416

volume = (4/3) * pi * r ** 3

print(f"The volume of the sphere with radius {r} is: {volume:.2f}")

 

30. Display total surface area and volume of sphere.

r = float(input("Enter the radius of the sphere: "))

surface_area = 4 * (22/7) * r ** 2

volume = (4/3) * (22/7) * r ** 3

print(f"The total surface area of the sphere with radius {r} is: {surface_area:.2f}")

print(f"The volume of the sphere is: {volume:.2f}")

 

31. Display total surface area of hemisphere.

r = float(input("Enter the radius of the hemisphere: "))

tsa  = 3 * (22/7) * r ** 2

print(f"The total surface area of the hemisphere is: {tsa:.2f}")

 

32. Display volume of hemisphere.

r = float(input("Enter the radius of the hemisphere: "))

volume = (2/3) * (22/7) * r ** 3

print(f"The volume of the hemisphere with radius {r} is: {volume:.2f}")

 

33. Display total surface area and volume of hemisphere.

r = float(input("Enter the radius of the hemisphere: "))

TSA = 3 * (22/7) * r ** 2

volume = (2/3) * (22/7) * r ** 3

print(f"The total surface area of the hemisphere is: {TSA:.2f}")

print(f"The volume of the hemisphere is: {volume:.2f}")

 

34. Display total surface area of cylinder.

r = float(input("Enter the radius of the cylinder: "))

h = float(input("Enter the height of the cylinder: "))

TSA = 2 * (22/7) * r * (h + r)

print(f"The total surface area of the cylinder is: {TSA:.2f}")

 

35. Display volume of cylinder.

r = float(input("Enter the radius of the cylinder: "))

h = float(input("Enter the height of the cylinder: "))

volume = (22/7) * r ** 2 * h

print(f"The volume of the cylinder is: {volume:.2f}")

 

36. Display total surface area and volume of cylinder.

r = float(input("Enter the radius of the cylinder: "))

h = float(input("Enter the height of the cylinder: "))

TSA = 2 * (22/7) * r * (h + r)

volume = (22/7) * r ** 2 * h

print(f"The total surface area of the cylinder is: {TSA:.2f}")

print(f"The volume of the cylinder is: {volume:.2f}")

 

37. Display total surface area of cuboid / box.

l = float(input("Enter the length of the cuboid: "))

b = float(input("Enter the breadth of the cuboid: "))

h = float(input("Enter the height of the cuboid: "))

TSA = 2 * (l*b + b*h + h*l)

print(f"The total surface area of the cuboid is: {TSA:.2f}")

 

38. Display volume of cuboid / box.

l = float(input("Enter the length of the cuboid: "))

b = float(input("Enter the breadth of the cuboid: "))

h = float(input("Enter the height of the cuboid: "))

volume = l * b * h

print(f"The volume of the cuboid is: {volume:.2f}")

 

39. Display total surface area and volume of cuboid.

l = float(input("Enter the length of the cuboid: "))

b = float(input("Enter the breadth of the cuboid: "))

h = float(input("Enter the height of the cuboid: "))

TSA = 2 * (l*b + b*h + h*l)

volume = l * b * h

print(f"The total surface area of the cuboid is: {TSA:.2f}")

print(f"The volume of the cuboid is: {volume:.2f}")

 

40. Display total surface area of cube.

a = float(input("Enter the side of the cube: "))

TSA = 6 * a ** 2

print(f"The total surface area of the cube with side {a} is: {TSA:.2f}")

 

41. Display volume of cube

a = float(input("Enter the side of the cube: "))

volume = a ** 3

print(f"The volume of the cube with side {a} is: {volume:.2f}")

 

42. Display total surface area and volume of cube.

a = float(input("Enter the side of the cube: "))

TSA = 6 * a ** 2

volume = a ** 3

print(f"The total surface area of the cube with side {a} is: {TSA:.2f}")

print(f"The volume of the cube with side {a} is: {volume:.2f}")

No comments:

Post a Comment