Why this code not executed proper

#include
using namespace std;
int main(){
int i,j,n;
cin>>n;
cout<<"\n";
for(i=1; i<=n; i++){
for(j=i; j=n-1; j++){
cout<<" “;
}
for(j=i; j<=n; j++){
if(i==1 || i==n || j==1 || j==n){
cout<<”*";
}
else{
cout<<" ";
}

}
cout<<"\n";

}
}

hi @rathidevesh906_1dcc73a061c159bb you wrote j=n-1 in second for loop instead of i<=n-1

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.