Saturday, September 8, 2018

AREA OF TRIANGLE USING SIDE LENGTH(S) AND HEIGHT

 HERON 'S FORMULA
__________________________________________________________________________________________________________________________________________________________________

a = float(input('Enter first side: '))
b = float(input('Enter second side: '))
c = float(input('Enter third side: '))

s = (a + b + c) / 2

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

__________________________________________________________________________________________________________________________________________________________________

AREA OF TRIANGLE USING BASE HEIGHT


b = float(input('Enter base of a triangle: '))
h = float(input('Enter height of a triangle: '))

area = (b * h) / 2
print('The area of the triangle is %0.2f' % area)

__________________________________________________________________________________________________________________________________________________________________


AREA OF TRIANGLE IF TRIANGLE IS

EQUILATERAL


a = float(input('Enter first side: '))

area = (sqrt(3)*a*a)/4



can solve this method also

_________________________________________________________________________________________

















1 comment: