o n e d a y a t a t i m e .
Wednesday, September 19, 2018
QBASIC program to display sum of odd digits .
CLS
INPUT "Enter any number ";N
S = 0
WHILE N < > 0
R = N MOD 10
IF R MOD 2 = 1 THEN S = S + R
N = N \ 10
WEND
PRINT " Sum of odd digits =" ; S
END
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment