program main implicit none integer::N,query(10),passwd(10),i,j,num data query/10*0/ do i=1,10 num = 0 do j=0,9 query(i) = j call print_query(query) read *,N if(N.eq.10) return if(N.gt.num) then num = N passwd(i) = j end if end do query(i) = passwd(i) end do contains subroutine print_query(query) integer::query(10),i do i=1,10 write (*,'(i0)',advance='no') query(i) end do write (*,*) end subroutine print_query end program main