To find the factorial of given number using SUB Procedure. (Qbasic Code)

To find the factorial of given number using SUB Procedure. (Qbasic Code)
  • 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

Share :

Twitter
Back To Top

facebook main

counter

Powered by Blogger.