Wednesday, October 16, 2019

12. Qbasic Program to read perpendicular and base of a right angled triangle


12.      Using FUNCTION……END FUNCTION, write a program to read perpendicular and base of a right angled triangle to find hypoteneous.

DECLARE FUNCTION HYP(P, B)
CLS
INPUT "ENTER PERPENDICULAR"; P
INPUT "ENTER BASE"; B
PRINT "HYPOTENUSE="; HYP (P, B)
END
FUNCTION HYP (P, B)
HYP = (P ^ 2 + B ^ 2) ^ (1 / 2)
END FUNCTION

No comments:

Post a Comment