accept the length and breadth of a rectangle. calculate and print the area and perimeter with proper message.
Answers
Answered by
0
Answer:
length=int(input("Enter length of rectangle : "))
breadth=int(input("Enter breadth of rectangle : "))
area=length*breadth
perimeter=2*(length+ breadth)
print("Area of rectangle is ",area)
print("Perimeter of rectangle is", perimeter)
Explanation:
I'm using Python language here.
First we will take two input length and breadth from user of type int.
We took type int because we have to perform mathematical operations on the values. If we don't define type then the default will be string and will give an error. Next we calculated the area and perimeter using formula and printed the output using print function.
Hope, you understood the logic.
Similar questions
Computer Science,
2 days ago
Hindi,
2 days ago
Environmental Sciences,
2 days ago
Physics,
8 months ago