Getting different output

I was writing a code to print an sequence in triangle form, which is given below
#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;
}
cout<<1;
}
this is code the error is if I’m giving the input as 3 I’m only a getting a 2 line sequence…why is it so?

Hello @Legendankit

What is the pattern that you are trying to print ?

1
11
111
1001
11111
10001
In this format I’m trying to print

Hello @Legendankit

Your format contains 0’s while your code doesn’t print any 0.
How is it so ?

that’s what I’m asking what changes i nee to make to get this format .

Hello @Legendankit

I am NOT able to identify any pattern in your format.
Please share the link to the problem or explain what forms the input and the output to this problem.

Hello @Legendankit

I have your code.
But the format you are trying to print does NOT follow any pattern
1
11
111
1001
11111
10001

What pattern does this have for n = 6

Do one thing, I cannot send your current doubt to the mentor.
Please create a new doubt for this problem and your doubt will surely be cleared.

Sorry I did not get u can explain me how can i do that.

Hello @Legendankit

Again ask this doubt using the ask doubt button.

I’m not able to reopen my doubt there