The problem is indeed really simple. But it is still well designed, to make you think of all the cases.
The problem does not say that there will always be number 42! What if you reach the end of the file and still try to read numbers. then your scanf will wait forever!
Some people complained that the problem is too easy, but I'll keep it since, obviously some people didn't think of all the cases, and didn't solve it.