Can we initialize the row and col outside the while loop?

in this program if can i initialize row and col outside the while loop? because when i am trying to initialize it outside the while loop it is not running properly and not giving an exact output

Hello @Anku47 what is the questions and if possible share your code by saving it on Ide.codingblocks.com

the question is to print 0 and 1’s pattern like
1
11
111
1001
11111
100001
and so on

but when i try to initialize the variable outside the while loop it is not showing the exact output.
here is my code https://ide.codingblocks.com/s/430066

can you please provide me a perfect and easy code to solve this problem. ?? in which i may not need to use this while loop…

@Anku47 check this:

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.