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)
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
Prime Course Trailer
Related Banners
Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription
import math
r=int(input(“enter the radius of the circle :”))
print(round(math.pi*r**2,2))
# Easy to understand
r = int(input(‘enter the radius of a circle:’))
g = 2*3.14*r
print(g)