Here is my code :
#include<stdio.h>
int main()
{
int a[10],b[10],i,j;
printf("Enter the 10 element of array:\n");
for(int i=0;i<10;i++)
{
scanf(" %d\n",&a[i]);
}
printf("The Original elements of array:\n");
for(int i=0;i<10;i++)
{
printf(" %d\n",a[i]);
}
for(i=0,j=10;i<10;i++,j--)
{
b[i] = a[j-1];
}
printf("The revese order of elements of array:\n");
for(int i=0;i<10;i++)
{
printf(" %d\n",b[i]);
}
return 0;
}
out-put is: Enter the 10 element of array: 1 2 3 4 5 6 7 8 9 10 11
As,you can it get terminated once i enter 11,but i want it to terminate after 10.
The Original elements of array: 1 2 3 4 5 6 7 8 9 10
And here 11 is not showing up why?
The revese order of elements of array: 10 9 8 7 6 5 4 3 2 1 same here 11 is not showing up.
please check my code and help me out. thank you.