Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scanner sc = new Scanner(System.in);
- int n = sc.nextInt();
- int[] arr = new int[n];
- arr[0] = 2;
- System.out.print(arr[0]);
- for (int i = 1; i < n; i++)
- {
- arr[i] = arr[i - 1] * 2;
- System.out.printf(" %d", arr[i]);
- }
Advertisement
Add Comment
Please, Sign In to add comment