I need to write some java using 3 "for" loops that outputs
122333444455555
22333444455555
333444455555
444455555
55555
The code I have so far:
public static void problemFour() {
for(int i = 5; i >= 1; i--) {
for(int a = 1; a <= i; a++) {
for(int b = 1; b <= a; b++) {
System.out.print(a);
}
}
System.out.println();
}
}
This outputs
111112222333445
11111222233344
111112222333
111112222
11111
I've switched around a lot of combinations of ++'s --'s, <'s, >'s, 5's, and 1's.
I'm pretty stuck, if someone could point me in the right direction, that would be fantastic.