BubaLazi

p04_EvenPowersOf2

Mar 9th, 2017
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class AdvancedLoops {
  4.     public static void main(String[] args) {
  5.         Scanner console = new Scanner(System.in);
  6.  
  7.         int n = Integer.parseInt(console.nextLine());
  8.         int num = 1;
  9.  
  10.         for (int i = 0; i <= n; i+=2) {
  11.             System.out.println(num);
  12.             num*= 4;
  13.  
  14.         }
  15.  
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment