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