Please tell the error

#include
using namespace std;
int main() {
int n;
cin>>n;
int nsp=2n-1;
int nst=1;
for(int row=1;row<=2
n-1;row++)
{
int val=n;
for(int cst=1;cst<=nst;cst++)
{
cout<<val;
val–;
}
for(int csp=1;csp<=nsp;csp++)
{
cout<<" ";
}
int cst=1;
val++;
for( ;cst<=nst;cst++)
{
if(val==0)
{
val++;
continue;

		}
		else{
            cout<<val;
		
		val++;
		}
	}
	if(row<=n+1)
	{
		nst+=1;
		nsp-=2;
	}
	else 
	{
		nst-=1;
		nsp+=2;
	}
	cout<<endl;
}

return 0;

}

Hello @Bhavit_Singla,

From the next time, please share your code using https://ide.codingblocks.com/.
The way you have shared it is introducing many syntax errors to it.

Now, coming back to your code,

  1. The pattern should be printed with a space between every two values.

  2. There are only 9 rows in your output for n=5.
    Reason: outter is iterating for 2n-1
    Solution: 2
    n+1

  3. There is repetition of lines.
    5 4 3 2 1 0 1 2 3 4 5
    5 4 3 2 1 0 -1 -1 1 2 3 4 5
    5 4 3 2 1 0 1 2 3 4 5
    Because after printing the 6th line, val becomes -1.

Try to resolve above.
Suggestion: Dry run your code on paper.
If you still face any issue, feel free to ask.

Hope, this would help.
Give a like, if you are satisfied.