I have a code as following:
program th
implicit none
integer N1
integer maxi,ei,Nc,ns,na
real CH1,CH2
OPEN(unit=1,file='input_file',status="old")
read(1,*) ns !!!
read(1,*) ei !!!!!!!!!!!!!!!
read(1,*) maxi!!!!!!!!!!!!!!!!!!!
read(1,*) N1!!!!!!!!!!!!!!!!
close(unit=1)
CH1 = 0.07
CH2 = -0.35
Na = INT(abs(2.*((N1/2)*CH1 + (N1/2)*CH2)))
write(*,*) Na,abs(2.*((real(N1)/2.)*CH1 + (real(N1)/2.)*CH2));stop
end program th
and the input file is
1 !!!!!!!!!!!
1 !!!!!!!!!!
1 !!!
1600
Then I compile it with
ifort -O3 -autodouble t1.f90 -o out
but when I execute it I get 447 for na
which is not correct. The correct answer is 448.