To input the sides of triangle and to check whether a triangle can be formed or not.

To input the sides of triangle and to check whether a triangle can be formed or not. (Qbasic Code)
CLS
top:
INPUT "Enter the length of the first side of triangle"; a
INPUT "Enter the length of the second side of triangle"; b
INPUT "Enter the length of the third side of triangle"; c
IF a + b > c AND b + c > a AND c + a > b THEN
    PRINT "Triangle can be formed"
ELSE
    PRINT "Triangle can not be formed"
END IF
PRINT
INPUT "Do you want to check more (Y/N)?"; ans$
IF UCASE$(ans$) = "Y" THEN
    GOTO top:
ELSE
    SYSTEM
END IF
END


Share :

Twitter
Back To Top

facebook main

counter

Powered by Blogger.