You are here: Home / Topics / Python Program to find the area of triangle

Python Program to find the area of triangle

Filed under: Python on 2023-09-17 21:55:27

#!/usr/bin/python
# -*- coding: utf-8 -*-
# Python Program to find the area of triangle

# 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

# calculate the area

area = (s * (s - a) * (s - b) * (s - c)) ** 0.5
print 'The area of the triangle is %0.2f' % area

About Author:
S
Shyam Dubey     View Profile
If you are good in any field. Just share your knowledge with others.