Hollow rhombus pattern solution

in my code running everything goes fine but in first row an extra star gets added but i am not able to figure out why is it happening

#include
using namespace std;
int main() {
int n,i,row;
cin>>n;
for(row=1;row<=n;row++)
{
if(row==n)
{
for(i=1;i<=n;i++)
{
cout<<’’;
}
}
else{
if(row==1)
{
for(i=1;i<=n-1;i++)
{
cout<<’ ‘;
}
for(i=1;i<=n;i++)
{
cout<<’
’;
}
}
else
{
for(i=1;i<=n-row;i++)
{
cout<<’ ‘;
}
cout<<’*’;
}

			for(i=1;i<=n-2;i++)
			{
				cout<<' ';
			}
			cout<<'*';
		}
        cout<<endl;
	
}

return 0;

}

hi @abhinavai21_5c95a2a2e1fb9fe8,
updated https://ide.codingblocks.com/s/664154

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.