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

! Exercise 4.3, Number 1.
  program E3X01
    implicit none
    integer :: I, J, K, L, Loop, If_Count
    real :: Test, Total
! start program E3X01
    do Loop = 1, 2
      If_Count = 0
      Total = 0.0
      read (unit = *, fmt = *) K, L
      do I = L, K
        do J = 1, I
          Test = real( I + J - 8 )
          If_Count = If_Count + 1
          if (Test > 0.0) then
            Total = Total + Test
          end if
        end do
      end do
      write (unit = *, fmt = *) If_Count, Total
    end do
    stop
  end program E3X01

