! ===================================================
! Function returns f(a) + f(a+1) + ... + f(b)
! ===================================================
   FUNCTION SerieSum(f, a, b)
   IMPLICIT NONE

   INTEGER  SerieSum
   INTEGER, INTENT(IN) :: a
   INTEGER, INTENT(IN) :: b

   include "func.h"

   INTEGER :: i

   SerieSum = 0

   DO i = a, b
     SerieSum = SerieSum + f(i)
   END DO

   RETURN
   END

