! 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 5.24. Pascal's triangle (binomial coefficients).
  program F24
    implicit none
    integer, parameter :: M = 20
    integer :: N, R
    integer, dimension(0: M) :: Pascal
! start program F24
    do N = 0, M
      Pascal(0) = 1
      Pascal(N) = 1
      do R = N - 1, 1, -1
        Pascal(R) = Pascal(R) + Pascal(R - 1)
      end do
      write (unit = *, fmt = *) Pascal(0: N)
    end do
    stop
  end program F24
