V3FIT
factorial.f
1  RECURSIVE FUNCTION factorial(num) RESULT(fact)
2  USE stel_kinds
3  IMPLICIT NONE
4  INTEGER, INTENT(IN) :: num
5  REAL(rprec) :: fact
6  INTEGER:: nfact
7 
8  IF(num == 1 .or. num == 0) THEN
9  nfact = 1
10  ELSE
11  nfact = num*factorial(num-1)
12  END IF
13 
14  fact = nfact
15 
16  END FUNCTION factorial