Qbasic program to find whether a triangle is equilateral , isosceles or scalene triangle
CLS
INPUT “ENTER THREE SIDES OF A TRIANGLE”; 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
USING SUB
DECLARE SUB NATURE(A,B,C)
CLS
INPUT “ENTER THREE SIDES OF A TRIANGLE”; A,B,C
CALL NATURE(A,B,C)
END
SUB NATURE(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
0 Comments