Create a program to calculate and print the area of a rectangle if the user enters 1 and print the area of a square if the user enters 2 in python.
pls answer fast
the one who will answer I will mark him as a brilliant!!
Answers
Answered by
1
Answer:
def square():
s = float(input(“Enter the side of the square: “))
print(“Area of square =”, s * s)
def rectangle():
le = float(input(“Enter the length of the rectangle: “))
b = float(input(“Enter the breadth of the rectangle: “))
print(“Area of the rectangle =”, le * b)
print(“Press 1 to calculate Area of Square”)
print(“Press 2 to calculate Area of Rectangle”)
f = int(input())
if f == 1:
square()
elif f == 2:
rectangle()
else:
print(“Error 404: Wrong number pressed, cannot calculate area!”)
Answered by
1
Answer:
If it is java
Explanation:
in square you have to change length and breadth and write side
in formula write side*side
If it was helpful mark me Brainliest
Attachments:
Similar questions