galinyotsev123

ProgBasics07Nested-Loops-P03evenPowersOf2

Jan 7th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P03evenPowersOf2 {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int n = Integer.parseInt(scanner.nextLine());
  8.  
  9. for (int power = 0; power <= n; power += 2){
  10. double result = Math.pow(2, power);
  11. System.out.printf("%.0f%n", result);
  12. }
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment