can you please explain the program for pattern on the topic solve on hacker blocks
though my programming is running but i didnt understand it completely
Program of pattern
Please paste the problem statement here.
#include using namespace std; int main() { int n; cin>>n; int row = 1; while(row<=n){ int col = 1; if(row%2!=0){ while(col<=row){ cout<<1; col = col + 1; } } else{ cout<<1; while(col<=row-2){ cout<<0; col = col + 1; } cout<<1; } cout<<endl; row = row + 1; } return 0; }
program is to print this
1
11
111
1001
11111
10001
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.