Factorial of given number Function Procedure (QBasic Code)

To find the factorial of given number Using FUNCTION Procedure (Qbasic Code)
  • DECLARE FUNCTION factorial (n)
    CLS
    INPUT "Enter a number"; n
    PRINT "The factorial of the given number is"; factorial(n)
    END

    FUNCTION factorial (n)
    f = 1
    FOR i = 1 TO n
        f = f * i
    NEXT i
    factorial = f
    END SUB

Share :

Twitter
Back To Top

facebook main

counter

Powered by Blogger.