knyazer

Untitled

Dec 8th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. Scanner sc = new Scanner(System.in);
  2. int n = sc.nextInt();
  3.  
  4. int[] arr = new int[n];
  5.  
  6. arr[0] = 2;
  7. System.out.print(arr[0]);
  8.  
  9. for (int i = 1; i < n; i++)
  10. {
  11. arr[i] = arr[i - 1] * 2;
  12. System.out.printf(" %d", arr[i]);
  13. }
Advertisement
Add Comment
Please, Sign In to add comment