regarding compilation error!!

#include<stdio.h>
int main()
{
int array[5],i;
for(i=0;i<5;i++)
{
{
scanf("%d",&array[i]);
}
if(array[i]==42)
{
break;
}
else
printf("%d ",array[i]);
}
return 0;
}

what is the problem in its compilation??

There is no compilation error in this segment of the code.

I tried your solution to recheck, and got a WA. Here’s the link:

https://www.codechef.com/viewsolution/11231693

However, going by the code, looks like you are trying to solve “Life, the Universe, and Everything”. Therefore, there are a few things you must keep in mind. The numbers could be greater than 5 or 10. They could even be 10^6 or 10^7, so code accordingly.

If after sometime you are not able to figure out your mistakes, refer to my solution, here

https://www.codechef.com/viewsolution/5157697

You are declaring a array of 5 element , acc to question Life ,the Universe , there can be many numbers in input, There is no compilation error in your program .
May be you are submitting your code with any other language ,submit it with c/c++ .
But still your sol will get WA verdict
Solution

#include<stdio.h>
int main()
{
int array[5],i;
for(i=0;i<5;i++)
{
{
scanf("%d",&array[i]);
}
if(array[i]==42)
{
break;
}
else
printf("%d ",array[i]);
}
return 0;
}

On CodeChef your class cannot be public, use default: FiredOut and Kodi App. Thanks a lot for this.

Are you taking some input out of the range of int.
If not than there should not be any any error.

I checked your code personally and it’s going fine.

On CodeChef your class cannot be public, use default: Tango For PC. Thanks a lot for this.

No condition on size of array mate

i don’t see any problem here. what is the printed message ?