Computer Science, asked by YOURDADPRODUCTION, 1 day ago

To input length and breadth of rectangle of float type and calculate area of rectangle. [Python Chapter, Class 9th]​

Answers

Answered by samarthkrv
8

Answer:

len = float(input("Enter the length of the rectangle:")

bred = float(input("Enter the breadth of the rectangle:")

area = len*bred;

print("The area of the rectangle with length",len,"breadth",bred,"is",area)

Explanation:

Answered by Anonymous
17

This problem is about calculating the area of a rectangle by taking user input of length and breadth of a rectangle of float type.

Required program:

# Taking user input to accept the length

length = float(input("Enter the length of a rectangle: "))

# Taking user input to accept the breadth

breadth = float(input("Enter the breadth of a rectangle: "))

# Calculating the area of a rectangle by using formula

area_of_rectangle = length * breadth

# Displaying the result

print("The area of a rectangle is ", area_of_rectangle, "square cm.")

Explanation:

We ask the user to input the value of length and breadth of a rectangle and stored them in float type.

We use to formula for finding the area of a rectangle, i.e., area of rectangle = length * breadth.

Finally, we assign the result, using print function.

Similar questions