Python Program To Find Area Of A Right Angled Triangle

Python Program To Find Area Of A Right Angled Triangle

Pythagoras-Theorem

The above image is showing the “Pythagoras theorem” where the sum of the “BASE” square and the “PERPENDICULAR” square is equal to the square of “HYPOTENUSE”. You can see one solved example in below image.

 

Right-Triangle-Dimensions

 

Example

def checkRightTriangle(BASE,PERPENDICULAR,HYPOTENUSE):
    if (HYPOTENUSE**2) == (BASE**2 + PERPENDICULAR**2):
        return True
    else:
        return False
 
def areaOfRightTriangle(base,perpendicular,hypotenuse):
    flag = checkRightTriangle(base,perpendicular,hypotenuse)
    if (flag):
        print("Area Of Right Angle: ",0.5*base*perpendicular)
    else:
        print("Given Input Values Are Not Represent Right Triangle")


def findMaxValue(a,b,c):
    if (c>b & c>a):
        areaOfRightTriangle(a,b,c)
    elif(a>b & a>c):
        areaOfRightTriangle(b,c,a)
    else:
        areaOfRightTriangle(a,c,b)

A=13
B=12
C=5
findMaxValue(A,B,C)

Output:

Area Of Right Angle:  30.0

Leave a comment