Advertisement
Zidinjo

Tannenbaum

Nov 10th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.47 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Tannenbaum {
  3.  
  4.     public static void main(String[] args) {
  5.        
  6.         Scanner scanner = new Scanner(System.in);
  7.        
  8.         System.out.println("Bitte geben Sie die hoehe ein :)");
  9.        
  10.         int hoehe = scanner.nextInt();
  11.                
  12.         for(int i=0;i<hoehe; i++)
  13.         {
  14.             for(int j=0;j<hoehe -1 -i ; j++)
  15.             {
  16.                 System.out.print(" ");
  17.             }
  18.            
  19.             for(int k=0; k<i*2+1;k++)
  20.             {
  21.                 System.out.print("*");
  22.             }
  23.             System.out.println("");
  24.         }
  25.  
  26.     }
  27.    
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement