What is the error in this ganesha code

#include
using namespace std;
int main() {

int n;
cin >> n;

cout << "*";
for(int i=1;i<=(n-3)/2;i++) {
	cout << " ";
}
for(int i=1;i=(n+1)/2;i++) {
	cout<< "*";
}
cout << endl;

for(int row=1;row<=(n-3)/2;row++) {
	cout << "*";
	for(int i=1;i<=(n-3)/2;i++) {
		cout << " ";
	}
	cout << "*";
}
cout << endl;

for(int i=1;i<=n;i++) {
	cout << "*";
}
cout << endl;

for(int row=1;row<=(n-3)/2;row++) {
	
	for(int i=1;i<=(n-3)/2+1;i++) {
		cout << " ";
	}
	cout << "*";
	for(int i=1;i<=(n-3)/2;i++) {
		cout << " ";
	}
	cout << "*";
}

cout << endl;

for(int i=1;i<=(n+1)/2;i++) {
	cout << "*";
}
for(int i=1;i<=(n-3)/2;i++) {
	cout << " ";
}
cout << "*";

return 0;

}

runtime error is because of this

i recommend you to dry run this code once
it’s important to understand working of these patterns

here in condition i<= (n+1)/2;
but
your approach is only correct for n=5

while writing the code don’t hard coded the value

try to genralise the code think alll possible senarios

first try again if not able to solve then only see the Reference Code

divide the whole swastik into 3 parts upper ,middle and lower

upper part and lower has it’s own logic but middle part is so simple just print β€œ*”

Reference Code

i recommend you to dry run this code once
it’s important to understand working of these patterns

this reference code is link
click on that

Please mark this doubt as resolved