Simple input ( challanges )

#include
using namespace std ;

int main()
{ int n;
cin>>n;
int x,y;
x=1;
while ( x <= n ){
cin>> y ;
if ( y<0 ){
break ;
}
x=x+1;
cout <<y << endl;

}


return 0;

}

PLEASE TELL THE FAULT IN MY CODE AS I AM NOT GETTING THE OUTPUT FOR THE SIMPLE INPUT QUESTION

@G_rahil this is because your approach is wrong this question input given as running stream of numbers not as in number of element in first line so make your logic for running stream

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.