12345, the output is 34512, don't know where the code is out of question, hope someone can see,
#include
Int main () {
Int m, n, I, temp, a, [100].
The scanf (" % d % d ", & amp; N, & amp; m);
for(i=0; i
}
//m items before to exchange, such as 123 to 321
for(i=0; i
A [I]=a, [m - I - 1].
A [m - I - 1)=temp.
}
//will be behind all item exchange, such as 45678 for 87654
For (I=m; i
A [I]=a [n - 1 - I + m);
A [n - 1 -i + m]=temp;
}
A [n]='\ 0';
//array elements should be 32187654 at this time, and then reverse the output would be 45678123
For (I=n - 1; I>=0; I -) {
printf("%d ",a[i]);
}
return 0;
}
CodePudding user response:
//m items before to exchange, such as 123 to 321
for(i=0; iTemp=a, [I].
A [I]=a, [m - I - 1].
A [m - I - 1)=temp.
}