print(N) :- N < 11, write(N), N is N+1, print(N).
?-print(1).

A PROLOG solution.