QBasic Programming

WAP to input three sides of a triangle and determine whether a triangle is right angled triangle or not

CLS
INPUT “ENTER HEIGHT, BASE AND PERPENDICULAR”; H, B, P
IF H ^ 2 = (B ^ 2 + P ^ 2) THEN
PRINT “IT IS A RIGHT ANGLED TRIANGLE”
ELSE
PRINT “IT IS NOT A RIGHT ANGLED TRIANGLE”
END IF
END
USING SUB PROCEDURE

DECLARE SUB CHECK (H, B, P)
CLS
INPUT “ENTER HEIGHT, BASE AND PERPENDICULAR”; H, B, P
CALL CHECK (H, B, P)
END
SUB CHECK (H, B, P)
IF H ^ 2 = (B ^ 2 + P ^ 2) THEN
PRINT “IT IS A RIGHT ANGLED TRIANGLE”
ELSE
PRINT “IT IS NOT A RIGHT ANGLED TRIANGLE”
END IF
END SUB

USING FFUNCTION PROCEDURE

DECLARE FUNCTION CHECK$ (H, B, P)
CLS
INPUT “ENTER HEIGHT, BASE AND PERPENDICULAR”; H, B, P
PRINT CHECK$ (H, B, P)
END

FUNCTION CHECK$ (H, B, P)
IF H ^ 2 = (B ^ 2 + P ^ 2) THEN
CHECK$  = “IT IS A RIGHT ANGLED TRIANGLE”
ELSE
CHECK$  = “IT IS NOT A RIGHT ANGLED TRIANGLE”
END IF
END FUNCTION

WAP to input three sides of a triangle and determine whether a triangle can be formed or not (Prev Lesson)
(Next Lesson) WAP to input three angles of a triangle and determine whether a triangle is right angled triangle or not
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!