life ,the universe this is my first program on this plat form why this is not workig

#include
#include<conio.h>
using namespace std;
int main()
{
int i,a[10000],n;
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];
for(i=0;i<n;i++)
{
if(!(a[i]==42))
{
cout<<a[i];
}
else
break;

}
return 0;
getch ();

}

There can be more than 10000 numbers. There is no limit on how many times you will take input. The question says you have to print numbers till you see 42. So, just write an infinite loop , input a number if it is not 42 , print the number otherwise break the loop.

Hope it helps. If you still have doubts, do tell .

Happy Coding and Welcome to Codechef.

Please use ideone or pastebin or atleast paste of code using code snippets.

can in this loop so that it works well