Code: Select all
The following program explains MOD. Type this program (except my comments) into Qbasic accurately and run it to see how MOD works.
1 CLS this command clears the screen, so it’s empty
INPUT "Enter the first number "; a
INPUT "Enter the second number "; b
IF b = 0 THEN checks if the second number is zero, because you can’t divide by zero
PRINT "the second number cannot be 0. Try again."
DO: LOOP WHILE INKEY$ = "" waits for you to press a key to continue
GOTO 1 then sends you back to line 1
END IF
CLS clear the screen again
.............................