Python Online Compiler
Example: Python program to find the area of a triangle if base and height are given
C
C++
C#
Java
Python
PHP
main.py
STDIN
Run
# Python program to find the area of a triangle if base and height are given print("Enter the base & height of the triangle::") b, h, a = float(input()), float(input()), None # b = base # h = height # a = area # Calculate area of the triangle a = (float)((b * h) / 2) # Output print("Area of the triangle = ", a, " sq. units")
5 7
Output
Clear
ADVERTISEMENTS