Explan the meaning of the question

If row number is n (>1), total character is n. First and last character is n-1 and rest are 0.
ones explain the meaning

The logic is simple. When the column position is 0 ie. j==0 and also when j==i (ie. the diagonal element) you will always have to print 1.
In other Cases when j!=0 , you will have to check if i%2==0(ie. even positioned row) . If it is an even positioned row, you will have to print 1, else print 0.

When input is 6:
1 ----> since j==0
11 —> since j==0, j==i
111 —> since j==0, i%2==0, j==i
1001 —> since j==0, i%2!=0, i%2!=0, j==i
11111
100001
and so on.

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.

1 11 202 3003 40004 Explanation If row number is n (>1), total character is n. First and last character is n-1 and rest are 0.

i have asked another question bhaiya