Questions
Write a python program to find the area and circumference of a circle.
Last Updated : 25 Oct 2026
Jul 24
Solution:
import math
def calculate_circle_properties():
try:
# Prompt the user to enter the radius as a decimal number
radius = float(input("Enter the radius of the circle: "))
if radius < 0:
print("Radius cannot be negative. Please enter a positive number.")
return
# Calculate Area (πr²) and Circumference (2πr)
area = math.pi * (radius**2)
circumference = 2 * math.pi * radius
# Display results rounded to 2 decimal places
print(f"\n--- Circle Properties ---")
print(f"Radius: {radius}")
print(f"Area: {area:.2f}")
print(f"Circumference: {circumference:.2f}")
except ValueError:
print("Invalid input! Please enter a valid numerical value.")
# Run the program
if __name__ == "__main__":
calculate_circle_properties()
✔
Verified by Expert