QBASIC PROGRAM TO FIND MIDDLE NUMBER AMONG THREE NUMBERS

QBASIC PROGRAM TO FIND MIDDLE NUMBER AMONG THREE NUMBERS



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

USING SUB


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 A; “IS MIDDLE NUMBER”
 ELSEIF B > A AND B < C OR B < A AND B > C THEN
 PRINT B; “IS MIDDLE NUMBER”
 ELSE
 PRINT C; “IS MIDDLE NUMBER”
 END IF
 END SUB

Post a Comment

0 Comments