Python Program to Calculate Area & Perimeter of the Rectangle

This Python program calculates the area and perimeter (circumference) of the rectangle. The length and breadth of a rectangle are given by user.

Following formula are used to clculate area and perimeter of rectangle:

Area of Rectangle = length * breadth

Perimeter of Rectangle = 2 (length + breadth)

Python Source Code: Area & Perimeter of Rectangle


# Area & Perimeter of Rectangle

# Reading length from user
length = float(input("Enter length of the rectangle: "))

# Reading breadth from user
breadth = float(input("Enter breadth of the rectangle: "))

# Calculating area
area = length * breadth

# Calculating perimeter
perimeter = 2 * (length * breadth)

# Displaying results
print("Area of rectangle = ", area)
print("Perimeter of rectangle = ", perimeter)

Output

Enter length of the rectangle: 23
Enter breadth of the rectangle: 17
Area of rectangle =  391.0
Perimeter of rectangle =  782.0