Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Shavit Borisov
- // CW
- import java.util.Scanner;
- public class arrSwap {
- public static void main(String[] args)
- {
- Scanner in = new Scanner(System.in);
- final int SIZE = 10;
- int[] arr = new int[SIZE];
- int temp;
- for(int i = 0; i < SIZE; i++)
- {
- System.out.printf("arr[%d] = ", i);
- arr[i] = in.nextInt();
- }
- for(int i = 0; i < SIZE / 2; i++)
- {
- temp = arr[i];
- arr[i] = arr[SIZE - 1 - i];
- arr[SIZE - 1 - i] = temp;
- }
- for(int i = 0; i < SIZE; i++)
- {
- System.out.printf("arr[%d] = %d\n", i, arr[i]);
- }
- in.close();
- }
- }
Add Comment
Please, Sign In to add comment