Please specify corrections in the following code

#include
using namespace std;
int main() {
int row,col,N;
cin>>N;
for(row=1;row<=2N-1;row++){
for (col=1;col<=row;col++){
if(row==1||row==2
N-1){
cout<<"";
cout<<endl;
}
if(row==2||row==2
N-2){
if(col==5){
cout<<’ ';}
else{
cout<<"*";
}
cout<<endl;
}

		if(row==3||row==2*N-3){
		    if(col==4&&col==5&&col==6){
		        cout<<' ';}
		    else{
				cout<<"*";}
		    cout<<endl;
		}
		if(row==4||row==2*N-4){
		    if(col==3&&col==4&&col==5&&col==6&&col==7){
		        cout<<' ';}
		    else{cout<<"*";
		    }
			
		    cout<<endl;
		}
		if(row==5||row==2*N-5){
		    if(col==2&&col==3&&col==4&&col==5&&col==6&&col==7){
		    cout<<' ';}
		    else{cout<<"*";}
		   
		    cout<<endl;
		        
		    }
		}
	}
}

link to the problem- https://online.codingblocks.com/app/player/246132/content/235743/4704/code-challenge

hi @sbhardwaj1be21_2a991b329433c059 dont hardcode values
refer this do a dry run on paper https://ide.codingblocks.com/s/666881

https://ide.codingblocks.com/s/666881 when we have i=2 from the first counter… then on reaching the 11th line .how did we get * from j=1 i.e from the first column itself. Ideally it should start from j=2… as j=i and i=2 for that loop?

hi @sbhardwaj1be21_2a991b329433c059 do a dryrun on paper for value 5, hope this helps:)

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.