Hi all,
I have two files
111
112
113
111
114
&
115
115
116
117
117
118
I wanted to compare each value from file 1 with all values in file 2 and write the outputs if file1(i)+3==file2. my code is
open(11,file='f1')
i=1
32 read(11,*,end=98)file1(i)
open (12,file='f2')
31 read(12,*,end=99)file2
if(file1(i)+3.eq.file2)then
write(*,*)file1(i),file2,i
end if
go to 31
99 continue
close(12)
i=i+1
go to 32
98 continue
end program test
output is
112 115 2
112 115 2
113 116 3
114 117 5
114 117 5
the third col is array index I am looking how this array index can be made continuous ie 1,2,3 instead 2,3,5
Thanks in advance
I have two files
111
112
113
111
114
&
115
115
116
117
117
118
I wanted to compare each value from file 1 with all values in file 2 and write the outputs if file1(i)+3==file2. my code is
open(11,file='f1')
i=1
32 read(11,*,end=98)file1(i)
open (12,file='f2')
31 read(12,*,end=99)file2
if(file1(i)+3.eq.file2)then
write(*,*)file1(i),file2,i
end if
go to 31
99 continue
close(12)
i=i+1
go to 32
98 continue
end program test
output is
112 115 2
112 115 2
113 116 3
114 117 5
114 117 5
the third col is array index I am looking how this array index can be made continuous ie 1,2,3 instead 2,3,5
Thanks in advance