Created
April 30, 2014 17:26
-
-
Save hfoxy/0da9d35425730f97cf38 to your computer and use it in GitHub Desktop.
Pyramid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int rows = 4; | |
for(int i = 0; i < rows; i++) { | |
StringBuilder builder = new StringBuilder(); | |
for(int i2 = 0; i2 < i; i2++) { | |
builder.append(" "); | |
} | |
for(int i2 = 0; i2 <= i; i2++) { | |
builder.append("*"); | |
if(i2 > 0) { | |
builder.append(" "); | |
} | |
} | |
System.out.println(builder.toString()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment