The title description has n integers, so that the previous number in the order to move backward m position, the last m number into the front number of m, see figure. Write a function: To achieve the above function, in the main function input n number and output adjusted n number. Enter the number of input data n n integer moved position m output moving N number sample input
101 2 3 4 5 6 7 8 9 102
Sample output
1#include <stdio.h>2 #defineN 1003 4 //Move Once5MoveintA[],intN)6 {7 intI, temp = a[n-1];8 for(i = n1; I >=1; i--)9 {TenA[i] = a[i-1]; One } Aa[0] =temp; - } - the - intMainintargcChar Const*argv[]) - { - intA[n], N, I, M; +scanf"%d", &n); - for(i =0; I < n; i++) + { Ascanf"%d", &a[i]); at } -scanf"%d", &m);//Move m position - - for(i =0; I < (m%n); i++) - Move (A, n); - in for(i =0; I < n; i++) - { toprintf"%d", A[i]); + } - return 0; the}
1046:c Language Programming Tutorial (third Edition) after class exercise 10.4