Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.34 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Test {
  4.     public static void main(String args[]) {
  5.  
  6.        
  7.         Scanner sc = new Scanner(System.in);
  8.         System.out.println("Zahl eingeben: ");
  9.         int x= sc.nextInt();
  10.        
  11.         int ergebnis=1;
  12.        
  13.         for(int i=0;i<x;i++){
  14.             ergebnis*=2;
  15.        
  16.         System.out.printf("%5d\n",ergebnis);
  17.        
  18.         }
  19.        
  20.        
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement