Wednesday, October 16, 2019

65. Qbasic program to input number and display only odd digits


65.      Write a function program to input number and display only odd digits.

DECLARE FUNCTION ODD (N)
REM
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT " ODD DIGITS ARE ";
D = ODD(N)
END
FUNCTION ODD (N)
WHILE N <> 0
R = N MOD 10
IF R MOD 2 = 1 THEN PRINT R;
N = N \ 10
WEND
END FUNCTION

No comments:

Post a Comment