Showing wrong answer for pascal triangle

#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
int k=2*n-1;
int a[n][k+2];
int p=n-1;
int q=2;
int c,d,i,j;
memset(a,0,sizeof(a));
a[0][n]=1;
for(i=1;i<n;i++)
{
c=p,d=q;
while(dā€“)
{
a[i][c]=a[i-1][c-1]+a[i-1][c+1];
c+=2;
}
pā€“;
q++;
}
for(i=0;i<n;i++)
{
for(j=1;j<=k;j++)
{
if(a[i][j]==0)
cout<<" ā€œ;
else
cout<<a[i][j]<<ā€ ā€œ;
}
cout<<ā€\n";
}

return 0;

}

please share code in cb ide

@ashishnnnnn
spaccing issue h output meh
image
is required
and ur code has fewer spaces

refer this for spacing ( code java meh h but u just need to see where spacing has to be added )