Output:
* * *** * *** ***** * *** ***** *******
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | public class HelloWorld{ public static void main(String []args){ int max=10; // height for(int x=0;x<max;x++){ for(int y=0;y<x+1;y++){ for(int z=0;z<max-y-1;z++){ System.out.print(" "); } for(int z=0;z<(y*2)+1;z++){ System.out.print("*"); } System.out.println(); } } } } |
No comments:
Post a Comment