Life, the Universe, and Everything: Runtime Error(NZEC)

I’m trying to submit code for the problem “Life, the Universe, and Everything” under the Section “Practice(easy)”. But I’m getting this error message

Runtime Error(NZEC)

But in code Blocks the below is working fine. Whats wrong

#include<stdio.h>
void main()
{
int i;
scanf("%d",&i);
while(i!=42&&i<100)
{
    printf("\n%d",i);
    scanf("%d",&i);
}
return ;
}

NZEC stands for Non Zero Exit Code. For C users, this will be generated if your main method does not have a return 0; statement.

So declare main() as int and put return 0 in end.

Correct code:

#include<stdio.h>
int main()
{
int i;
scanf("%d",&i);
while(i!=42)
{
    printf("%d\n",i);  ///print a new line after printing i
    scanf("%d",&i);
}
return 0 ;
}

See here.

declare main as int main and return 0

try saving out the numbers in array and then printing out the whole output at a time with a line break