We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
In any row, the sum of spaces and stars are equal to N. Number of stars increases by one and number of spaces before stars decreases by 1 in consecutive rows.
In any row R, we will first print N-R space characters then R star characters.
Staircase
You are viewing a single comment's thread. Return to all comments →
Here, we will use two for loops, outer for loop will print one row of star pattern ans second row will print space characters and # characters.
In any row, the sum of spaces and stars are equal to N. Number of stars increases by one and number of spaces before stars decreases by 1 in consecutive rows.
In any row R, we will first print N-R space characters then R star characters.