What is wrong with this code for the "Life, the Universe, and Everything" problem.

Why the codechef showing error.


#include<stdio.h>
int main(void){
    int j;
    int i;
    for (i = 0; i < 10; i++) {
        scanf("%d",&j);
        if (j==42) {
            break;
        }
        printf("%d\n",j);
    }
    return 0;

}

There is now where mentioned that number of test cases are only 10.
You have to scan numbers until 42 that’s the only condition given !

In this you have considered maximum number of input to be ten but that is not true maximum number of input can be more than 10 .
here is the corrected


[1]


  [1]: http://www.codechef.com/viewsolution/4151566

I remember that in my school :

the for loop used to be for(i=0;i<10;i++) for arrays

and for(i=1;i<=10;i++) otherwise.

//