Read the program and answer the given questions (Qbasic) - 1

DECLARE FUNCTION sum(n)
CLS
INPUT "Entery any number"; num
s = sum(num)
PRINT s
END

FUNCTION sum (n)
WHILE n <> 0
    r = n MOD 10
    sum = sum + r
    n = INT(n / 10)
WEND
END FUNCTION

Questions:

1. What will be the output of the program if user inputs the number 436?
    Ans: If user inputs the number 436, the output of the program will 13.
2. What will be the outpur of the program if user inputs the number 463?
    Ans: If user inputs the number 436, the output of the program will 13.
3. List the name of procedure modules declared in the above program.
    Ans: The procedure name is SUM which is function procedure.

Share :

Twitter
Back To Top

facebook main

counter

Powered by Blogger.