I tried this problem but I am unable to print the pattern Please help me with the code

int main()

{

int n,i,j,val;
cin>>n;

cout<<"1"<<endl;
for(i=0;i<n;i++){
        for(j=0;j<i;j++){
            cout<<i+1;
            for(int k=0;k<i-2;k++){
                cout<<"0";
            }
            cout<<i+1;
        }
        cout<<endl;
}
return 0;

}

I don’t even know that this is the right one.

take a look at code attached below
i have explain inside it if you have further doubts you can ask

i hope this help
if you have more doubts regarding this feel free to ask
if your doubt is resolved mark it as resolved from your doubt section inside your course