QBasic Programming

WAP to enter any three numbers and display the middle number

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 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 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
USING FUNCTION PROCEDURE
DECLARE FUNCTION MIDDLE (A, B, C)
INPUT “ENTER ANY THREE NUMBERS”; A, B, C
PRINT “THE MIDDLE NUMBER IS”; MIDDLE (A, B, C)
END
FUNCTION MIDDLE (A, B, C)
IF A > B AND A < C OR A < B AND A > C THEN
M = A
ELSEIF B > A AND B < C OR B < A AND B > C THEN
M = B
ELSE
M = C
END IF : MIDDLE = M : END FUNCTION

WAP to enter any three numbers and display the smallest one (Prev Lesson)
(Next Lesson) WAP to enter any three numbers and display the greatest, smallest and the middle number
Back to QBasic Programming
Notice: compact(): Undefined variable: limits in /home/bhimgautam34/public_html/wp-includes/class-wp-comment-query.php on line 853

Notice: compact(): Undefined variable: groupby in /home/bhimgautam34/public_html/wp-includes/class-wp-comment-query.php on line 853

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!