class TriangleDrawing{
public static void main(String args[]){
for(int x = 1; x <= 6; x++){
for(int y = 1; y <= (6-x); y++){
System.out.print(" ");
}
for(int z = 0; z < (x + (x-1)); z++){
System.out.print("*");
}
for(int p = 1; p <= (6-x); p++){
System.out.print(" ");
}
System.out.println();
}
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter