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
