Python Program – Find Area of Circle

Area of Circle

To find the area of a circle whose radius is given, use math.pi constant and apply the following formula.

Area of Circle = math.pi * radius * radius


In the following program, we shall define a function areaOfCircle() that takes radius as an argument and return the area of circle.

We read radius as integer from user, call areaOfCircle() with the radius passed as argument. You can also read radius as float from user using float() function. In the following program we use int() and you may try float() as practice.


radius of circle, where radius>0.

Python Program

import math

def areaOfCircle(radius) :
    if radius < 0:
        print('Radius cannot be negative.')
    return math.pi * radius * radius

r = int(input('Enter radius : '))
area = areaOfCircle(r)
print(f'Area of Circle : {area}')


Enter radius : 5
Area of Circle : 78.53981633974483

Important Points regarding above program

  • We imported Python math library to use the value of PI.
  • input() function reads a string from standard input. Therefore, we have used int() function to convert string to integer.
  • If given radius is less than zero, we are returning nothing.

Related Tutorials

Code copied to clipboard successfully 👍