please xplain the logic
How to proceed for this can anyone explains the logic
Hi rohan
You need to code nested loops, the outer loop keeps track of the row number, the inner loops keeps track of a particular row, like how many stars and spaces to print according to pattern.
for first half:
for each row i no. of spaces = 2*i - 1 (except i=0, where no.of spaces = 0), no of stars = N-(no. of spaces)
similary for second half but in decreasing order
Hope it helps:)
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.