Wednesday, October 16, 2019

60. Qbasic program to input three sides of a triangle and determine whether a triangle is equilateral, isosceles or scalene triangle or not


60.      Write a sub program to input three sides of a triangle and determine whether a triangle is equilateral, isosceles or scalene triangle or not.

DECLARE SUB CHECK (A, B, C)
CLS
INPUT “ENTER THREE SIDES OF A TRIANGLE”; A,B,C
CALL CHECK (A, B, C)
END

SUB CHECK (A, B, C)
IF A = B AND B = C THEN
PRINT “IT IS A EQUILATERAL TRIANGLE”
ELSEIF A = B OR B = C OR C = A THEN
PRINT “IT IS ISOSCELES TRIANGLE”
ELSEIF A < > B AND B < > C THEN
PRINT “ IT IS A SCALENE TRIANGLE”
END IF
END SUB

No comments:

Post a Comment