#include <iostream>
using namespace std;

int main() {
    int x;
    cin>>x;
    for(int i=1; i<=x-1; i++){
        for(int j=1; j<=x; j++){
            if(i==1 || i==x-1 || j==1 || j==x){
                cout<<"* ";
            }
            else cout<<"  ";
            
            
        }
        cout<<endl;
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: