Basic Programs


Python program to find area of circle using radius


Write a python program to input circle radius(r) from the user and calculate area of circle(A).

Formula is,

A=Πr22

Where,

  • Π - constant value (3.141592653589793)
  • r - radius of the circle
example.py
import math
r=float(input("Enter the radius of a circle : "))
a=math.pi*r*r
print("Area of Circle is %.2f"%a)

Output

Enter the radius of a circle : 5
Area of Circle is 78.54

math.pi constant returns the value of pi : 3.141592653589793

Prev Next