/**
* Digit Pyramid (v1.01)
* GoToLoop (2016-Apr-20)
* forum.processing.org/two/discussion/16145/need-help-with-some-code
*/
final int ROWS = 9;
for (int n = 1, r = 1; r <= ROWS; ++r, n = 1) {
String s = "";
while (n < r) s += n++;
s = nf(int(s), ROWS - 1).replace('0', ' ');
while (n > 0) s += n--;
println(s);
}
exit();
Answers
Sorry that didn't come out correctly, but it is supposed to look like this:
Start with something simple and work your way up to it! Given a number X, can you print out a SQUARE of characters that is X long by X wide?
For example:
Now instead of X's, can you print out NUMBERS?
For example:
How about with X's AND numbers, in a triangle?
Like this:
Hint: How many X's are you printing on the first line? How many X's less do you print on the next line, and the ones after that?
Thanks so much!
Homework
Don't use gotoloops code, it is too dense for you, rewrite it so it matches your skill level
100+plus for what Chirsir said. No homework should asked here.