PROGRAM sum_order
IMPLICIT NONE
INTEGER*8 :: i
REAL :: sum_up, sum_down
INTEGER*8 :: lim
PRINT *,'enter number of items added in series'
READ(*,*)lim
sum_up = 0.0
sum_down = 0.0
DO i = 1,lim
sum_up = sum_up + REAL(i)
sum_down = sum_down + REAL(1+lim-i)
ENDDO
PRINT *,sum_up, sum_down, sum_up-lim*(lim+1)/2, sum_down-lim*(lim+1)/2
END PROGRAM sum_order