I have this fortran 95 do-loop code which return answers in array form, please how do i find the SUM of the answers (fv) without writing them out, because they're iterative and subject to change. thanks
!.......vapor fraction..............
do i=1,6
FV=Z(I)*(K(i)-1)/(VOLD*(K(i)-1)+1)
write(*,99001)FV
END DO
I saw a similar code where someone did:
Real :: Zi(99),Ki(99),NV,FNV,FPNV
FNV = 0.
FPNV = 0.
Do i=1,NCOMP
FNV= FNV + Zi(i)*(Ki(i)-1)/(NV*(Ki(i)-1)+1)
FPNV = FPNV + (1)*Zi(i)*(Ki(i)-1)**2/((NV*(Ki(i)-1)+1)**2)
end do
NV1= NV - (FNV/(-1)*FPNV)
Hence the values of FNV
and FPNV
are summed up in the do
..end do
loop.