Program 13:- Write a program to calculate the hypotenuse of the right-angled traingle given as follows:
|\
| \
| \
| \
| \
| \ ?
3 | \
| \
| \
|_________\
4
Hypotenuse = Square_Root {(Base)^2 + (Height)^2}
= Square_Root {(3)^2 + (4)^2}
= 5
Answers
Answered by
3
import math *#Import Math Module*
Base = int(input('Enter the base of a right - angled triangle:'))
Height = int(input('Enter the height of a right-angled traingle:'))
print('Triangle details are as follows:')
print('Base = ',Base)
print('Height = ',Height)
Hypotenuse = math.squrt(Base * Base + Height * Height)
print('Hypotenuse =',Hypotenuse)
*Output*
Enter the base of a right-angled triangle:3
Enter the Height of a right-angled triangle:4
Triangle details are as follows:
Base = 3
Height = 4
Hypotenuse = 4
Hypotenuse = 5.0
Similar questions