You are viewing a single comment's thread. Return to all comments →
From a java perspective a solution would be like below:
public static void staircase(int n) { IntStream.range(1, n+1).forEach(i -> { printChars((n-i), " "); printChars(i, "#"); System.out.println(""); }); } public static void printChars(int count, String c) { for (int i = 0; i < count; i ++) { System.out.print(c); } }
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 →
From a java perspective a solution would be like below: