! Program Example from "Essential Fortran 90 & 95" by Loren P. Meissner
! Copyright 1996. Copying for sale requires permission from the author.
! Otherwise, distribution is permitted if these three lines are included.

!  Example 7.4. Compute factorials of small integers.
  program H04
    implicit none
    integer :: N, Factorial, Loop
!  start program Factory
    N = 0
    do
      Factorial = 1
      write (unit = *, fmt = *) " Now finding the factorial of ", N
      do Loop = 1, N
        if (Factorial > huge( 1 ) / Loop) then
          write (unit = *, fmt = *) " The factorial is too large. "
          stop
        end if
        Factorial = Factorial * Loop
      end do
      write (unit = *, fmt = *) " The factorial is: ", Factorial
      N = N + 1
    end do
    stop  ! This statement is never executed.
  end program H04

