real function integral(a, h, m) ! real function integral(a, h, m) ! performs midpoint integration with forloop implicit none real :: a, h, x integer :: m, i integral = 0.0 ! initialize integral do i=1,m x = a+(i-0.5)*h ! mid-point of increment i integral = integral + cos(x)*h enddo return end