Life, the Universe, and Everything
Disclaimer: I'm not sure if this code will be the solution for SPOJ.

You don't check if the input number is an int.

if (scanf("%d", &amp;i) == 1)
{
    printf("OK\n");
} 
else
{
    printf("Not an integer.\n");
}




You don't ever tell the user what to enter.

printf("%s\n", "Enter what you think the answer is to life, the universe, and everything (hint: it's a number).");




This is more of a nitpick, but the while loop could be created in a better fashion instead of breaking.

while (i != 42)




Another nitpick, you don't add a newline after printing the int.

printf("%d\n", i);