My code is failing the test cases even though I checked for the test cases in another compiler
#include<stdio.h>
int main(void) {
int n,x=1,a=0;
printf(“enter value of n \n”);
scanf("%d",&n);
for(int i=0;i<=2n;i++)
{
if(i>n) {
a=i-2x;
x++;}
else
a=i;
for(int j=0;j<=2*n;j++)
{
if(j<=a)
printf("%d ",n-j);
else if(j>=2*n-a)
printf("%d ",j-n);
else
printf(" ");
}
printf("\n");
}
return 0;
}