In this Python example, we will learn how to calculate the area of the circle. In this program, we calculate the area of the circle in three ways. The first way is to use the radius and the second way is to use the circumference of the circle and the third way is by using the diameter.

Formula

Area of the Circle = πr2

Area of the Circle using Circumference = (Circumference *Circumference)/(4*π)

Area of the Circle Using Diameter = (π/4) * (diameter * diameter)

Here is the source code of the program to calculate the area of the circle.

Program 1: Python Program To Find the Area Of Circle Using Radius

Python Program To Find the Area Of Circle Using Radius

# Python Program to Find Area Of Circle using Radius
# Declare the Value of PI
PI = 3.14
# Take the Input From the User
radius = float(input("Enter the radius of a circle: "))
# Area of the Circle
area = PI * radius * radius
# Circumference of Circle
circumference = 2 * PI * radius
# Print the Output
print("\nArea Of a Circle = %.2f" %area)
print("\nCircumference Of a Circle = %.2f" %circumference)

Output

Enter the radius of a circle: 6

Area Of a Circle = 113.04

Circumference Of a Circle = 37.68

Program 2: Python Program To Find the Area Of Circle Using Circumference

Python Program To Find the Area Of Circle Using Circumference

# Python Program to Find Area Of Circle using Circumference
# Declare the Value of PI
PI = 3.14
# Take the Input From the User
circumference = float(input("Enter the Circumference of a circle: "))
# Calculate the Area
area = (circumference * circumference)/(4 * PI)
# Print the Output
print("Area Of a Circle = %.2f" %area)

Output

Enter the Circumference of a circle: 6

Area Of a Circle = 2.87

Program 3: Python Program To Find the Area Of Circle Using Diameter

Python Program To Find the Area Of Circle Using Diameter

# Python Program To Find the Area Of Circle Using Diameter
# Import Module
import math
# Take the Input from the user
diameter = float(input("Enter the Diameter of a circle: "))
# Calculate the Area of the Circle Using Diameter
area1 = (math.pi/4) * (diameter * diameter)
# To Convert Radius to Diameter
# diameter = 2 * radius
# To Convert Diameter to Radius
radius = diameter / 2
# Calculate the Area of the Circle Using Radius
area2 = math.pi * radius * radius
# Print the Output
print("Area of Circle using direct formula Using Diameter = %.2f" %area1);
print("Area of Circle Using Method 2 = %.2f" %area2)

Output

Enter the Diameter of a circle: 6

Area of Circle using direct formula Using Diameter = 28.27

## Comments