DIM X,D,R,K AS LONG INPUT X K=0 R = 0 WHILE X>0 K=K+1 D = X MOD 10 R = R + D X = X \ 10 WEND PRINT R, K