## 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