Qbasic program to find total number of odd digits in a number
CLS
INPUT "ENTER ANY NUMBER"; N
C = 0
WHILE N < > 0
R = N MOD 10
IF R MOD 2 = 1 THEN C = C + 1
N = N 10
WEND
PRINT "TOTAL NUMBER OF ODD DIGITS"; C
END
USING SUB
DECLARE SUB TOTALODD(N)
CLS
INPUT "ENTER ANY NUMBER"; N
CALL TOTALODD(N)
END
SUB TOTALODD(N)
C = 0
WHILE N < > 0
R = N MOD 10
IF R MOD 2 = 1 THEN C = C + 1
N = N 10
WEND
PRINT "TOTAL NUMBER OF ODD DIGITS"; C
END SUB
0 Comments