Würde mich freuen wenn mir jemand hier mal kurz helfen könnte )))
import java.util.*;
public class drawTree {
/**
* @param args
*/
public static void main(String[] args) {
drawTree(5);
}
void drawTree( int height ) {
// Krone
int spaces = height - 1;
for( int i = 1; i <= height; i++ ) {
for( int j = 0; j < spaces; j++ ) {
System.out.print( " " );
}
for( int k = 0; k < (2 * i); k++ ) {
System.out.print( "*" );
}
System.out.println( "" );
spaces--;
}
// Stamm
for( int i = 0; i < 2; i++ ) {
for( int j = 0; j < (height - 1); j++ ) {
System.out.print( " " );
}
System.out.println( "**" );
}
}
}
kingbozz Gast |