Pattern mountain question

THIS IS MY CODE. I AM NOT SURE WHY THIS IS NOT WORKING. PLZ HELP.

#include
using namespace std;
int main() {
int i,j,k,n;
cin>>n;
for(i=1;i<=n;i++){
i=k;
for(j=1;j<=(2i-1);j++){
if(j<=i){
cout<<j<<’\t’;
}
else if((j+k==2
i) && j!=1){
while(k!=0){cout<<k<<’\t’;
k–;}

    }
    else cout<<'\t';

    
}
cout<<endl;

}
}

@Satvik25 Whenever you want to share your code, save it on Coding Blocks IDE and share its link.
For pattern building problems, i would suggest you to dry run your own code and point out where it is going wrong.
Anyway, i am giving you some hints, you can try it again with it:
Consider for n=4
1________1
1 2_____2 1
1 2 3__3 2 1
1 2 3 4 3 2 1
For the first row, there are 2*n-3 spaces and for subsequent rows, it decrements by 2.
First work to print the numbers in increasing order then print the spaces accordingly and then the same pattern of numbers but in reverse order.
So first do work for numbers then for spaces and then for numbers again.
And then update variables accordingly for next iterations.
Each number is separated from other by a tab so use ’ \t’ for tab space.

int nsp=2*n-3; //initializing number of spaces
int nst=1; //initializing number of numbers

for(int i=1;i<=n;i++)
{
int num=1;
//work for numbers before spaces of center
for(int cst=1;cst<=nst;cst++)
{
if(cst!=n)
cout<<(num+"\t");

num++;
}

//work for spaces
for(int csp=1;csp<=nsp;csp++)
{
cout<<(" \t");
}

//work for numbers after spaces in center
for(int cst=num-1;cst>=1;cst–)
{
cout<<(cst+"\t");
}
//preparation for next iteration
nsp=nsp-2;
nst++;
cout<<endl;
}

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.