Write a program in Python to find the area of triangle
Answers
Answered by
9
The answer is in the attachment.
Thank you.
Attachments:
Answered by
9
The following codes must be written in script mode, saved and then executed.
The file must be saved using the '.py'/'.pyw' extension. Run > Run Module or F5 enables execution in Python Shell.
CODE 1:
height = int(input("Enter the height of the triangle:"))
base = int(input("Enter the base of the triangle:"))
print("The area of the triangle is", 1/2*height*base)
OUTPUT:
12
5
CODE 2:
height = int(input("Enter the height of the triangle:"))
base = int(input("Enter the base of the triangle:"))
area = 1/2*height*base
print("The area of the triangle is", area)
OUTPUT:
12
5
Similar questions