0

Q- Use swapping concept to swap the elements of 1D array consist of 10 integers. Ask the user to enetr the values of array elements then print them out to the screen before and after swapping.

e.g. a[0] ----> a[9]

a[1] ----> a[8]

a[2] ----> a[7]

a[3] ----> a[6]

a[4] ----> a[5]

what i did is ..

```
#include<iostream.h>
void main()
{
int a[10],temp;
for(int i=0;i<5;i++)
cin>>a[i];
for(int j=9;j>5;j--)
cin>>a[j];
for(int i=0,j=9;i<5,j>5;i++,j--)
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
for(i=0;i<5;i++)
cout<<a[i]<<"\t";
cout<<"\n";
for(j=9;j>5;j--)
cout<<a[j];
}
```

* I think there's something goes wrong or missing with this code ... umm if u just put me on the right direction, i'd really appreciate it.