224k views
3 votes
Write a program that calculates the area & perimeter of a rectangle, where

the values for width and length are given by the users.

1 Answer

9 votes

Answer:

In Python:

Length = float(input("Length: "))

Width = float(input("Width: "))

Area = Length * Width

Perimeter = 2*(Length + Width)

print(Area)

print(Perimeter)

Step-by-step explanation:

This gets the length from the user

Length = float(input("Length: "))

This gets the width from the user

Width = float(input("Width: "))

This calculates the area

Area = Length * Width

This calculates the perimeter

Perimeter = 2*(Length + Width)

This prints the area

print(Area)

This prints the perimeter

print(Perimeter)

User Manshu
by
5.4k points