Python Program - How to Calculate Area of a Circle
by matt392 in Circuits > Software
99 Views, 1 Favorites, 0 Comments
Python Program - How to Calculate Area of a Circle


Short Python program that calculates the area of a circle.
Equation is Area of a Circle = [Pi]*[radius (squared)] or Pi*r^2.
Program is below and attached:
=====================================================
# Python program that calculates the area of a circle
# Formula is [pi] * [Radius^2]
import math
# Get the radius from the user
radius = input("Enter the radius of the circle: ")
# Convert string that was input to an integer
radiusofcircle = int(radius)
# Calculate the area of the circle
radiussquared = radiusofcircle**2
areaofcircle = math.pi * radiussquared
print ("The radius entered is: ", radiusofcircle)
print ("The area of the circle is: ", areaofcircle)