Calculating the area of circle using Python

How to find area of circle using python ?

Here, in this page we will discuss the progrm to find area of circle using python .Area of circle is the number of square units inside the circle , can be calculated using the radius and diameter.The formula for evaluating the area of circle is

  • Area of circle using radius=   Pi*r*r    ( r is the radius of circle)
  • Area of circle using diameter=  1/4*Pi*d*d   ( d is the diameter of circle)

 

Area of circle using python

Algorithm

  • import pi from math
  • Set r = 3
  • Set are = pi*r*r
  • Print(area)

Code in Python

Run
from math import pi
r=3.00 
area=pi*r*r 
print("The area of circle is",end=" ") 
print(area)
Output :
The area of circle is 28.27

Using Diameter

  • import pi from math
  • Set d = 3
  • Set area = (pi*d*d)/4
  • Print(area)

Code in Python

Run
from math import pi
d=6.00
area=(pi*d*d)/4
print("The area of circle is",end="")
print(area)
Output :
The area of circle is 28.27

2 comments on “Calculating the area of circle using Python”