How to print star pattern in this?

Unable to fix the star pattern problem , i mean
don’t get the if logic in that , help me out sir !!

@piyushkumar999999
At each level below level 1, that is from level 2 onwards, the number of stars printed are 2*(l - 1) - 1.
I hope this is able to give you an intuiton.

If my answer was able to resolve your doubt, please mark the query as resolved.

Hey @piyushkumar999999
for this question we take an integer input as n.

Now we should do work for n rows, with the help of for loop.

Assuming row numbers in 0 based indexing, means first row has i =0 and second row has i = 1 and so on.

For every row we need to do two tasks.

  1. For ith row print numbers from 1 to (n-i)
  2. For ith row print (2*i -1) stars. (P.s. for 0th row value will be -1 so don’t print any stars).

Also print(’*’, end= ’ '), by default print prints every thing in new line, but here it will not shift to next line.
You need to use it as well.
Hope this resolved your doubt.
Plz mark it as resolved in my doubts section

Hey @piyushkumar999999
Is it resolved ??

hi @piyushkumar999999 do you have any more issues?

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.