Wednesday, October 16, 2019

59. Qbasic program to input three sides of a triangle and determine whether a triangle is right angled triangle or not.


59.      Write a function  program to input three sides of a triangle and determine whether a triangle is right angled triangle or not.

DECLARE FUNCTION CHECK$ (H, B, P)
CLS
INPUT “ENTER HEIGHT, BASE AND PERPENDICULAR”; H, B, P
PRINT CHECK$ (H, B, P)
END

FUNCTION CHECK$ (H, B, P)
IF H ^ 2 = (B ^ 2 + P ^ 2) THEN
CHECK$  = “IT IS A RIGHT ANGLED TRIANGLE”
ELSE
CHECK$  = “IT IS NOT A RIGHT ANGLED TRIANGLE”
END IF
END FUNCTION

1 comment: