! q = eroarea (corectia); sigma_q =suma erorilor

subroutine sum_N(n, p, s_EF, cor)
real p(n), s, s_ant, q, sigma_q
real s_EF
logical print_it; common print_it;

integer width

s_ant =p(1)
sigma_q =0.

do j =2,n

call sum_2(s_ant, p(j), s, q)

sigma_q =sigma_q +q

!*
if(print_it) then
if(j ==2) write(1,*)
iwj =width(j)
write(1, '(a, I<iwj>, a, 1pg15.8, a, 1pg15.8)') ' s(', j, ') = ', s, '   err  : ', q
endif

s_ant =s
enddo

s_EF =s +sigma_q
cor =sigma_q

!*
if(print_it) then
write(1, '(/, a, 1pg15.8, a, 1pg15.8)') ' s    = ', s, '   s_err: ', sigma_q;
endif

END
