Online Tutorials & Training Materials | STechies.com
Register Login

Python Program to Find Area of Circle

|| 0

Python Program to Find Area of Circle
Stechies

This tutorial explains how to create a simple python program to find area of a circle. This article contains simple source codes to find out the area of a circle using circumference, diameter and radius of a circle.

Formula to Calculate Area of a Circle

  • With Radius
A=π (r)2

here π = 22/7, r = radius of circle

  • With Diameter
A=1/4πd2

here π = 22/7, d = diameter of circle

  • With Circumference
A=c2/4π

here π = 22/7,  c = circumference of circle

Python Program to Find Area of Circle using Radius

#Program to find Area of Circle using radius

#Taking radius from user
r = float(input("Enter the radious of circle : "))
#Taking radius measure unit from user
unit = input("Enter the measure unit of radius (e.g. in, cm) : ")
#finding area of a circle using ( A = /\R*R ) formula
area = ((22/7) * (r*r))
#printing the area
print("Area of circle is : ",area,unit+"2")

OUTPUT :

Enter the radius of circle : 6.5
Enter the measure unit of radius (e.g. in, cm): m
Area of circle is : 132.78571428571428 m2

Python Program to Find Area of Circle using Diameter

#Program to find Area of Circle using Diameter

#Taking diameter from user
diameter = float(input("Enter the diameter of circle : "))
#Taking diameter measure unit from user
unit = input("Enter the measure unit of diameter (e.g. in, cm) : ")
#finding area of a circle using ( A = 1/4 * /\ * D*D ) formula
area = ((1 / 4) * (22 / 7) * (diameter * diameter))
#printing the area
print("Area of circle is : ",area,unit+"2")

OUTPUT :

Enter the diameter of circle : 20
Enter the measure unit of diameter (e.g. in, cm) : in
Area of circle is : 314.2857142857143 in2

Python Program to Find Area of Circle using Circumference

#Program to find Area of Circle using Circumference

#Taking circumference  from user
circumference  = float(input("Enter the circumference  of circle : "))
#Taking circumference  measure unit from user
unit = input("Enter the measure unit of circumference  (e.g. in, cm) : ")
#finding area of a circle using ( A = 1/4 * /\ * D*D ) formula
area = ((circumference  * circumference ) / (4 * (22 / 7) ))
#printing the area
print("Area of circle is : ",area,unit+"2")


OUTPUT :

Enter the circumference of circle : 42
Enter the measure unit of circumference (e.g. in, cm) : cm
Area of circle is : 140.3181818181818 cm2