Plz check why it is giving wrong output
Paras, pls change two things in your code…
Firstly change the size of array as : int a[100005];
and also while you are printing the array , use endl instead of space as output is given in this format only…
for(int i=0;i<n;i++)
{
cout<<a[i]<<endl;
}