! 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.

  program E24
    use E24M
    implicit none
    integer :: EoF
! start program E24
    open (unit = 2, file = "numeroso.txt", &
      status = "old", action = "read", position = "rewind")
    do
      read (unit = 2, fmt = *, iostat = EoF) X, Y
      if (EoF < 0) then
        exit
      end if
      call Tally( )
    end do
    call Report( )
      write (unit = *, fmt = *) " Item Count: ", How_Many
      if (How_Many > 0 ) then
      write (unit = *, fmt = *) " Means: ", X_Mean, Y_Mean
      if (How_Many > 1) then
        write (unit = *, fmt = *) X_Dev, Y_Dev, Covar, Correlation
      end if
    else
      write (unit = *, fmt = *) " Insufficient data in this file. "
    end if
    stop
  end program E24

