Computer Science, asked by kharkwalg, 11 months ago

write a python code to find the area of a triangle whose base and height is given​

Answers

Answered by QGP
1

Area of Triangle - Python

Simply take in the user input of the base and height and store them as float values.

The Area of Triangle is given by:

\sf Area = \dfrac{1}{2} \times Base \times Height

Calculate this and print it out.

Here's the code.

 \rule{320}{1}

# Program to find area of trinagle when base and height are given

# Take input of Base

base = float(input("Enter the base: "))

# Take input of height

height = float(input("Enter the height: "))

# Area of triangle = (1/2) * base * height

area = 0.5 * base * height

# Print out the area

print(f"Area of the triangle is {area} sq units.")

Attachments:
Similar questions