- int[] arr = new int[6];
- Scanner sc = new Scanner(System.in);
- for(int i = 0;i < arr.length;i++)
- {
- arr[i] =sc.nextInt();
- }
- for(int i = 0;i < arr.length/2;i++ ) //将arr数组中的内容反转
- {
- int temp =arr[i] ;
- arr[i] = arr[arr.length-i-1];
- arr[arr.length-i-1] = temp;
- }
复制代码 |
|