borkins

04. Even Powers of Two

Apr 12th, 2017
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.45 KB | None | 0 0
  1. /**
  2.  * Project: Advanced_Loops - created by borkins on 2017-04-08.
  3.  */
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class _04_EvenPowersOf2
  8. {
  9.     public static void main(String[] args)
  10.     {
  11.         Scanner console = new Scanner(System.in);
  12.        
  13.         int n = Integer.parseInt(console.nextLine());
  14.        
  15.         long nPow = 1 << n;
  16.        
  17.         for (long i = 1; i <= nPow; i <<= 2) {
  18.             System.out.println(i);
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment