Connect with one of the following accounts


Please wait while we redirect...

Views: 141   

Following program shows you how to calculate rectangle area and circumference.
This program gets rectangle length and width from user and calculates area and circumference and prints them using following formulas
Area = length X width
Circumference = 2 X length + 2 X width

rectangleLength = float(input("Enter length of rectangle:"))
rectangleWidth = float(input("Enter width of rectangle:"))
areaOfRectangle = rectangleLength * rectangleWidth
print("Area of rectangle is: ", areaOfRectangle)
circumferenceOfRectangle = 2 * (rectangleLength) + 2 * (rectangleWidth)
print("Circumference of rectangle is: ", circumferenceOfRectangle)


Enter length of rectangle: 12
Enter width of rectangle: 15
Area of rectangle is:  180.0
Circumference of rectangle is:  54.0

On By

Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News