Program to classify the type of triangles. (i.e. equilateral, isosceles, or scalene).


Program to classify the type of triangles. (i.e. equilateral, isosceles, or scalene).  (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 OR b + c < a OR c + a < b THEN

    PRINT "Triangle can not be formed"

    GOTO 1:

ELSEIF a = b AND b = c AND c = a THEN

    PRINT "Equilateral Triangle"

ELSEIF a = b OR b = c OR c = a THEN

    PRINT "Isosceles Triangle"

ELSE

    PRINT "Scalene Triangle"

END IF

1:

PRINT

INPUT "Do you want to check more (Y/N)?"; ans$

IF UCASE$(ans$) = "Y" THEN

    GOTO top:

ELSE

    SYSTEM

END IF

END

Share :

Facebook Twitter
Back To Top

facebook

Powered by Blogger.