REM Factorial Calculator
REM Factorial of N (written as N!) is mathematical function whics consists of numbers from 1 to N mutiplied with each other
REM E.g. N! = 1 * 2 * ... * N
REM Here is recursive implementation of factorial function, based on formula N! = N * (N - 1)!
REM N is given as a command-line parameter
@ECHO off
IF "%1"==""  ( 
ECHO Enter parameter first
PAUSE
EXIT /b
)
CALL :factor %1
ECHO %1! = %result%
PAUSE
EXIT /b
:factor
IF %1==0  ( 
SET result=1
EXIT /b
)
SET /a prm=%1-1
CALL :factor %prm%
SET /a result*=%1
EXIT /b
