Regarding the solution of Pattren Q7

I solved Q7 as above… Is there any othe way to solve it? I am not asking for changing the loop…
And… will we have to create a new programme for even values of ‘n’?

hey @anujkumar8803_31012485f219a4df There is no other logic for this question other than which you have used.

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.

Sir, I did it with another logic which us also useful for both odd and even values of ‘n’. While previous solution was not printing correct output for even value of ‘n’.
Thank you for ur reply…