Computer Science, asked by kardamrekha25, 11 months ago

Write a program in Python to find the area of triangle

Answers

Answered by sagarmankoti
9

The answer is in the attachment.

Thank you.

Attachments:
Answered by Equestriadash
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:

\tt Enter\ the\ height\ of\ the\ triangle: 12

\tt Enter\ the\ base\ of\ the\ triangle: 5

\tt The\ area\ of\ the\ triangle\ is\ 60

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:

\tt Enter\ the\ height\ of\ the\ triangle: 12

\tt Enter\ the\ base\ of\ the\ triangle: 5

\tt The\ area\ of\ the\ triangle\ is\ 60

Similar questions