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;
}