Sunday, October 14, 2018

WAP To find the factorial of given number.

CLS
INPUT "Enter any number"; n
f = 1
FOR i = 1 TO n
    f = f * i
NEXT i
PRINT "The factorial of input number is"; f
END
   Using Sub Procedure.

DECLARE SUB factorial (n)
CLS
INPUT "Enter a number"; n
CALL factorial (n)
END

SUB factorial (n)
f = 1
FOR i = 1 TO n
    f = f * i
NEXT i
PRINT "The factorial of input number is"; f
END SUB


No comments:

Post a Comment