WAP to check whether a triangle can be formed with the given three sides or not

Qbasic program to check whether a triangle can be formed with the given three sides or not



CLS
 INPUT “ENTER THREE SIDES OF A TRIANGLE”; A,B,C
 IF (A + B) > C AND (B + C) > A AND (A + C) > B THEN
 PRINT “THE TRIANGLE CAN BE FORMED”
 ELSE
 PRINT “THE TRIANGLE CANNOT BE FORMED”
 END IF
 END

USING SUB


DECLARE SUB TRIANGLE(A,B,C)
 CLS
 INPUT “ENTER THREE SIDES OF A TRIANGLE”; A,B,C
 CALL TRIANGLE(A,B,C)
 END
 
 SUB TRIANGLE(A,B,C)
 IF (A + B) > C AND (B + C) > A AND (A + C) > B THEN
 PRINT “THE TRIANGLE CAN BE FORMED”
 ELSE
 PRINT “THE TRIANGLE CANNOT BE FORMED”
 END IF
 END SUB

Post a Comment

0 Comments