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)
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)
__________________________________________________________________________________________________________________________________________________________________
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)
__________________________________________________________________________________________________________________________________________________________________

you can try with your own method
ReplyDelete