1
2 2
3 0 3
4 0 0 4
5 0 0 0 5
Not able to undeestand the logic
Hello @dipeshpandey2001 in this you have to find the pattern between I and j .
Have you tried of any logic?
Take N (number of rows), print the following pattern (for N = 5) 1 2 2 3 0 3 4 0 0 4 5 0 0 0 5
not able to find the logic to print zeroes
@dipeshpandey2001 check this:
You can simply run two nested loops, from 1 upto n and then check
if(i==j || j==1) cout<<i;
else cout<<0;
okay let me try…
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.