Wednesday, October 16, 2019

55. Qbasic program to enter any three numbers and display the middle


55.      Write a program to enter any three numbers and display the middle number using sub procedure.

DECLARE SUB MIDDLE(A, B, C)
CLS
INPUT “ENTER ANY THREE NUMBERS”; A, B, C
CALL MIDDLE (A, B, C)
END
SUB MIDDLE (A, B, C)
IF A > B AND A < C OR A < B AND A > C THEN
PRINT “THE MIDDLE NUMBER IS”; A
ELSEIF B > A AND B < C OR B < A AND B > C THEN
PRINT “THE MIDDLE NUMBER IS”; B
ELSE
PRINT “THE MIDDLE NUMBER IS”; C
END IF
END SUB

No comments:

Post a Comment