Area and Perimeter of a Rectangle.
All rectangles are also parallelograms, but not all parallelograms are rectangles. The perimeter P of a rectangle is given by the formula, P=2l+2w or 2(l + w), where l is the length and w is the width of the rectangle. The area A of a rectangle is given by the formula, A=l*w , where l is the length and w is the width.
Input :
enter length 12
enter breadth 10
Output:
area is 120
perimeter is 44
Program to find area and perimeter of a rectangle.
#program to print area and perimeter of rectangle.
length = int(input("enter length "))
breadth = int(input("enter breadth "))
#area of rectangle = l*b
area = length * breadth
print("area is ",area)
#perimeter of rectangle= 2(l+b)
perimeter=2*(length+breadth)
print("perimeter is ",perimeter)
Output :
enter length 12
enter breadth 10
area is 120
perimeter is 44
Comments
Post a Comment
Type Your Comments !
Please do not enter any spam link in the comment box.