Skip to Main Content
Blog

Calculate Volume of Circle in Python

Calculate Volume of Circle in Python

Enter radius: 3
Enter height: 4
Volume: 37.69911184307752
Surface Area: 75.39822368615503
import math


def main():
	r = int(input("Enter radius: "))
	h = int(input("Enter height: "))

	v = math.pi * (r**2) * h / 3  # Volume of cone
	s = math.sqrt(r * r + h * h)  # Slant height
	a = math.pi * r * (s + r)  # Surface area of cone

	print("Volume:", v)
	print("Surface Area:", a)


if __name__ == "__main__":
	main()