Pattern Problem

This is the pattern to be printed:

This is the code that I have written:

int n;
cin>>n;
int row,col;
int st=n-1;    //no. of stars
int sp=1;     //no. of spaces
int N=2*n-1;
for(row=1; row<=N; row++){

	for(col=1; col<=st; col++){
		cout<<"*"<<"\t";
	}
	for(col=1; col<=sp; col++){
		cout<<"\t";
	}
	for(col=1; col<=st; col++){
		cout<<"*"<<"\t";
	}
	if(row<=N/2){
		st--;
		sp=sp+2;
	}
	else{
		st++;
		sp=sp-2;
	}
	if((row=1) && (row=N)){
       for(col=1; col<=N; col++){
		   cout<<"*"<<"\t";
	   }
	}
	cout<<endl;
}

The output shows “time limit exceeded”. What is the mistake?

Here you have to use double equal to
For comparison == is used and for assignment = is used

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.

Is the program ok otherwise?

Looks correct
You can check by submitting it
If not passed all testcase then let me know

It’s giving wrong answer. The first, middle and last rows are not printing any stars. They are blank.

okay np i will check and update you about your mistake soon

can you share link of your code?
so that i can run and check it

Here: https://ide.codingblocks.com/s/654212

Modified Code

I have corrected your code you can check it