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 input a number and prints its square if it is even otherwise print its cube. (Qbasic Code)

To input a number and prints its square if it is even otherwise print its cube. (Qbasic Code)
  • CLS
    INPUT "Enter a number"; n
    a = n MOD 2
    IF a = 0 THEN
        ans = n ^ 2
        PRINT "The given nuber is even and its square is"; ans
    ELSE
        ans = n ^ 3
        PRINT "The given nuber is odd and its cube is"; ans
    END IF
    END

Share :

Twitter
Back To Top

facebook main

Powered by Blogger.