QBasic Programming

WAP to input three sides of a triangle and determine whether a triangle is equilateral, isosceles or scalene triangle or not

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 PROCEDURE

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
USING FUNCTION PROCEDURE
DECLARE FUNCTION CHECK$ (A, B, C)
CLS
INPUT “ENTER THREE SIDES OF A TRIANGLE”; A,B,C
PRINT CHECK$ (A,B,C)
END

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

WAP to input three sides of a triangle and determine whether a triangle is equilateral triangle or not (Prev Lesson)
(Next Lesson) WAP to enter any 10 numbers and sort in ascending order
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!