write a program to input length and breadth of a rectangle calculate and print its area and perimeter (Phyton chapter)
Answers
Answer:
Breadth = float(input('Please enter the breadth of the Rectangle:'))
Length = float(input('Please enter the Length of the Rectangle:'))
#calculate the area
Area = Breadth * Length
#calculate the perimeter
Perimeter = 2 * (Length + Breadth)
print("Area of Rectangle = %2F"%Area)
print("Perimeter of Rectangle = %2F"%Perimeter)
______________________________________________________
Refer the attachment for the clear idea of how the output will appear. In the attachment, the value of length was entered 2 and breadth was 1. You can enter any values.
♣ Qᴜᴇꜱᴛɪᴏɴ :
Write a program to input length and breadth of a rectangle .Calculate and print it's area and perimeter (Phyton chapter)
★═════════════════★
♣ ᴄᴏɴᴄᴇᴘᴛ :
First we need to take input from user asking his/her for lenght and then breadth. Then we need to address how to calculate area and perimeter. It's done, Time to print !!!!
★═════════════════★
♣ ʀᴇQᴜɪʀᴇᴅ ᴄᴏᴅᴇ :
l =int(input("Length : "))
b =int(input("Breadth : "))
area = l*b
perimeter = 2*(l+b)
print("Area of Rectangle : ",area)
print("Perimeter of Rectangle : ",perimeter)