To find the sum of individual digits of the given number. (Qbasic Code)

To find the sum of individual digits of the given number. (Qbasic Code)
  • CLS
    INPUT "Enter a number"; n
    s = 0
    WHILE n <> 0
        r = n MOD 10
        s = s + r
        n = n \ 10
    WEND
    PRINT "The product of the digits is"; s
    END

Share :

Facebook Twitter Google+
Back To Top

facebook main

counter

Powered by Blogger.