open Printf;;
open Scanf;;
(* If under limit, count once and repeat. *)
let rec dostep curr limit =
if curr <= limit then begin
(printf "%d\n" curr);
(dostep (curr+1) limit)
end;;
(* Take input and start the count. *)
printf "Count: ";;flush stdout;;
scanf "%d" (fun i -> (dostep 1 i));;