program t implicit none integer::A,B integer::i read*,A,B do i=A,B if(IS(i).or.mod(i,3)==0)print"(I0)",i end do contains logical recursive function IS(N)result(res) integer::N if(mod(N,10)==3)then res=.true. else if(N<=10)then res=.false. else res=IS(N/10) endif end function end program t