• + 0 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;
            }
        }