QBasic Programming

WAP to input three sides of a triangle and determine whether a triangle is equilateral 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”
ELSE
PRINT “IT IS NOT A EQUILATERAL TRIANGLE”
END IF
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”
ELSE
PRINT “IT IS NOT A EQUILATERAL 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”
ELSE
CHECK$ = “IT IS NOT A EQUILATERAL TRIANGLE”
END IF
END FUNCTION

WAP to input three angles of a triangle and determine whether a triangle is right angled triangle or not (Prev Lesson)
(Next Lesson) WAP to input three sides of a triangle and determine whether a triangle is equilateral, isosceles or scalene triangle or not
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!