Home  |  IT Zone  |  Tips / Tricks  |  Did You Know  |  Inspirational  |  Health  |  World Infos  |  Insurance  |  Universities  |  Forex  |  Mathematics  |  Illusions  |  Children Day Quotes  |  Fun / Jokes  |  Decent Quotes  |  Birthday Msgs  |  Good Morning Msgs  |  Good Night Msg  |  Husband Wife Jokes  |  Teacher Students Jokes  |  Insult Jokes  |  Love Quotes  |  Sad Quotes  |  Funny Pics  |  Be Aware  |  Articles  |  Simple Joys of Life 

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

To find the product of the individual digits of the given number
  • CLS
    INPUT "Enter a number"; n
    p = 1
    WHILE n <> 0
        r = n MOD 10
        p = p * r
        n = n \ 10
    WEND
    PRINT "The product of the digits is"; p
    END

To find the product of individual digits of given number without using CALL statement.
  • DECLARE sub pro (n)
    CLS
    INPUT "Enter a number"; n
    pro n
    END
    SUB pro (n)
    p = 1
    WHILE n <> 0
        r = n MOD 10
        p = p * r
        n = n \ 10
    WEND
    PRINT "The product of the digits is"; p
    END SUB

Share :

Twitter
Back To Top

facebook main

Powered by Blogger.