MODULE const INTEGER, PARAMETER :: dp = KIND(1.0d0), sp = KIND(1.0e0) REAL(KIND=dp), PARAMETER :: dpi = 3.141592653589793d0 END MODULE const ! PROGRAM prog USE const IMPLICIT NONE ! ! Main program (also called a driver program) to compute ! n! in a subroutine. ! ! Compile these using ! gfortran factmain.f90 factsub.f90 ! INTEGER :: nin REAL(kind=dp) :: nfactorial WRITE(*,*) 'Input nin' READ(*,*) nin CALL factorial(nin,nfactorial) WRITE(*,*) 'n,n! = ',nin,nfactorial END PROGRAM prog