QBASIC PROGRAM TO PRINT ODD DIGITS FROM A NUMBER
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT "ODD DIGITS ARE ";
WHILE N < > 0
R = N MOD 10
IF R MOD 2 = 1 THEN PRINT R;
N = N \ 10
WEND
END
USING SUB
DECLARE SUB ODD(N)
CLS
INPUT "ENTER ANY NUMBER"; N
CALL ODD(N)
END
SUB ODD(N)
PRINT "ODD DIGITS ARE ";
WHILE N < > 0
R = N MOD 10
IF R MOD 2 = 1 THEN PRINT R;
N = N \ 10
WEND
END SUB
0 Comments