python/areaOfTriangle.py

16 lines
408 B
Python

# Python Program to find the area of triangle
A = 5
B = 6
C = 7
"""Uncomment below to take inputs from the user"""
# A = float(input('Enter first side: '))
# B = float(input('Enter second side: '))
# C = float(input('Enter third side: '))
"""calculate the semi-perimeter"""
S = (A + B + C) / 2
"""Calculating the area"""
AREA = (S*(S-A)*(S-B)*(S-C)) ** 0.5
print('The area of the triangle is %0.2f' %AREA)