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

  module I08M
    implicit none
    public :: Series_Sum
  contains
    function Series_Sum (M, N, S, D) result (Series_Sum_R)
      integer, intent (in) :: M, N
      real, intent (in) :: S, D
      real :: Series_Sum_R
      integer :: Loop
  ! start function Series_Sum
      Series_Sum_R = 0.0
      do Loop = M, N
        Series_Sum_R = Series_Sum_R + S + D * real (Loop)
      end do
      return
    end function Series_Sum
  end module I08M
