QBasic Programming

WAP to enter any two numbers and display the smaller one

REM
CLS
INPUT “ENTER ANY TWO NUMBERS”; A, B
IF A < B THEN
PRINT A; “IS SMALLER”
ELSE
PRINT B; “IS SMALLER”
END IF
END

USING SUB PROCEDURE

DECLARE SUB SMALL (A, B)
CLS
INPUT “ENTER ANY TWO NUMBERS”; A, B
CALL SMALL (A, B)
END

SUB SMALL (A, B)
IF A < B THEN
PRINT A; “IS SMALLER”
ELSE
PRINT B; “IS SMALLER”
END IF
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION SMALL (A, B)
INPUT “ENTER ANY TWO NUMBERS”; A, B
PRINT “THE SMALLER NUMBER IS”; SMALL (A, B)
END
FUNCTION SMALL (A, B)
IF A < B THEN
SMALL = A
ELSE
SMALL = B
END IF
END FUNCTION

WAP to enter any two numbers and display the greater one (Prev Lesson)
(Next Lesson) WAP to enter any three numbers and display the greatest one
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!