Plz check why it is giving wrong output

https://ide.codingblocks.com/s/245912 corrected code try to put if else

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;
}