program series

!-- compute the terms of the arithmetic progression (s + di) for i = m to n

  implicit none
  print *, series_sum(400, 700, 100.0, 0.1)
  
  contains
  
  function series_sum(m, n, s, d) result(series_sum_result)
  
  integer :: m, n, i
  real :: s, d, series_sum_result
  
  series_sum_result = 0.0
  do i = m, n
    series_sum_result = series_sum_result + s + i * d
  enddo
  
  end function series_sum
    
end program series
