I wanted to do this using array that is why the program is looking big, Its running properly showing the wanted output too still that online checker is saying my code is wrong. What can be the problem?
#include<iostream>
int main()
{
using namespace::std;
int i, y;
int x[80];
cin>>y;
for (i=0;i<y;i++)
{
cin>>x[i];
}
for (i=0;i<y;i++)
{
if(x[i]==42)
{break;}
cout <<x[i]<<endl;
}
return 0;
}