WRITE A QBASIC PROGRAM TO FIND FACTORIAL(FUNCTION)

QBASIC PROGRAM TO FIND FACTORIAL


QBASIC PROGRAM TO FIND FACTORIAL(FUNCTION)


Solution: -


DECLARE FUNCTION FACTORIAL(N)
CLS
INPUT "ENTER ANY NUMBER";N
PRINT "FACTORIAL=";FACTORIAL(N)
END

FUNCTION FACTORIAL(N)
F=1
FOR I= 1 TO N
F=F*I
NEXT I
FACTORIAL=F
END FUNCTION