Skip to content

Instantly share code, notes, and snippets.

@hfoxy
Created April 30, 2014 17:26
Show Gist options
  • Save hfoxy/0da9d35425730f97cf38 to your computer and use it in GitHub Desktop.
Save hfoxy/0da9d35425730f97cf38 to your computer and use it in GitHub Desktop.
Pyramid
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