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 Sum of Any Three Numbers (SUB Procedure) (Qbasic)

To Find The Sum of Any Three Numbers (Using SUB Procedure) (Qbasic)
  • Program with parameter
  •  DECLARE SUB sum (a, b, c)
     CLS
     CALL sum (a, b, c)
     END

     SUB sum (a, b, c)
     INPUT "Enter the first number"; a
     INPUT "Enter the Second number"; b
     INPUT "Enter the third number"; c
     s = a + b + c
     PRINT "The sum of the numbers is "; s
     END SUB
  • Program without empty parameter 
  •  DECLARE SUB sum ( )
     CLS
     CALL sum
     END

     SUB sum
     INPUT "Enter the first number"; a
     INPUT "Enter the Second number"; b
     INPUT "Enter the third number"; c
     s = a + b + c
     PRINT "The sum of the numbers is "; s
     END SUB
  • Program with different variable in parameter and argument.
  • DECLARE SUB sum (x, y, z)
    CLS
    CALL sum(a, b, c)
    END

    SUB sum (x, y, z)
    INPUT "Enter the first number"; a
    INPUT "Enter the Second number"; b
    INPUT "Enter the third number"; c
    s = a + b + c
    PRINT "The sum of the numbers is "; s
    END SUB
  • Program with different variable in parameter and argument (taking input in main module)
  • DECLARE SUB sum (x, y, z)
    CLS
    INPUT "Enter the first number"; a
    INPUT "Enter the Second number"; b
    INPUT "Enter the third number"; c
    CALL sum (a, b, c)
    END

    SUB sum (x, y, z)
    s = x + y + z
    PRINT "The sum of the numbers is "; s
    END SUB
  • See Also 

Share :

Twitter
Back To Top

facebook main

Powered by Blogger.