codescracker


python

Python Program to Calculate Area of Rectangle



« Previous Program Next Program »


Calculate Area of Rectangle in Python

To calculate area of rectangle in python, you have to ask from user to enter length and breadth of rectangle to calculate and print area of that rectangle on the output screen as shown in the program given below.

Python Programming Code to Calculate Area of Rectangle

Following python program ask from user to enter length and breadth of rectangle to calculate area:

# Python Program - Calculate Area of Rectangle
		
while True:
	print("Enter 'x' for exit.")
	leng = input("Enter length of Rectangle: ")
	brea = input("Enter breadth of Rectangle: ")
	if leng == 'x':
		break
	else:
		length = int(leng)
		breadth = int(brea)
		area = length*breadth
		print("Area of Rectangle =",area,"\n")

Here is the sample run of the above Python program shows how to calculate area of rectangle:

python calculate area of rectangle

Same Program in Other Languages

You may also like to learn or practice the same program in other popular programming languages:


« Previous Program Next Program »




Tools
Calculator

Quick Links
Signup - Login - Give Online Test