You are viewing a single comment's thread. Return to all comments →
My logic was: For each line print "n - t" spaces and "t #" and plus "t". But my code was a little bit different.
public static void staircase(int n) { int tmp = n - 1; while(tmp >= 0){ for(int i = 0; i < n; ++i) { System.out.print(i < tmp ? " " : "#"); } System.out.println(); --tmp; } }
Seems like cookies are disabled on this browser, please enable them to open this website
Staircase
You are viewing a single comment's thread. Return to all comments →
My logic was: For each line print "n - t" spaces and "t #" and plus "t". But my code was a little bit different.