Advertisement
myrdok123

04. Even Powers of 2

Mar 30th, 2024
503
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.37 KB | None | 0 0
  1. package ForLoop;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P04EvenPowersOf2 {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int number = Integer.parseInt(scanner.nextLine());
  10.  
  11.  
  12.  
  13.         for (int i = 0; i <= number ; i+=2) {
  14.  
  15.  
  16.             System.out.println(Math.pow(2, i));
  17.  
  18.         }
  19.  
  20.  
  21.     }
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement