Life,the universe, and everything

The link to the question is here- TEST Problem - CodeChef

So I have checked out he successful submissions and what they do is that they print the number right after its been scanned and the program stops taking input after 42 has been entered. I code in C. Please help its my first question here.

http://discuss.codechef.com/search/?csrfmiddlewaretoken=c5fa63b6a5549503d12fe09d20fb2eb6&q=life&t=question