1、
【问题描述】
从键盘输入10个整数,存放在一个数组中,然后使数组中的所有整数整体向后移动m个位置,最后m个数变成最前面的m个数,并输出移动后的结果。m从键盘输入。
【输入形式】
输入10个整数,每个整数间用空格分隔,回车。然后输入整数m。
【输出形式】
首先输出数组中的10个元素,然后输出后移m位以后的数组所有元素。
【输入输出样例】
Please input 10 numbers:
1 2 3 4 5 6 7 8 9 10
Your numbers are:
1 2 3 4 5 6 7 8 9 10
Please input m:
3
The new numbers are:
8 9 10 1 2 3 4 5 6 7
package learn;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
System.out.println("Please input 10 numbers:");
Scanner in=new Scanner(System.in);
int[] arr=new int[10];
int m;
for(int i=0;i<10;i++){
arr[i]=in.nextInt();
}
System.out.println("Your numbers are:");
print(arr);
System.out.println("Please input m:");
m= in.nextInt();
int[] res=new int[10];
for(