62.
Write a program to
enter a number and find the product of its digits using FUNCTION procedure.
DECLARE FUNCTION PROD (N)
CLS
INPUT "ENTER ANY NUMBER"; N
PR = PROD (N)
PRINT "PRODUCT OF DIGITS"; PR
END
FUNCTION PROD (N)
P = 1
WHILE N < > 0
R = N MOD 10
P = P * R
N = N \ 10
WEND
PROD = P
END FUNCTION
No comments:
Post a Comment