5 5 5 5 5
4 4 4 4
3 3 3
2 2
1
Run Code Online (Sandbox Code Playgroud)
如何使用c生成模式以上的模式我试过这个
int i, j, N;
scanf("%d", &N);
for(i=N; i>=1; i--)
{
//Logic to print spaces
for(j=N; j>i; j--)
{
printf(" ");
}
//Logic to print numbers
for(j=1; j<=i; j++)
{
printf("%d ", i);
}
for(j=N; j>i; j--)
{
printf(" ");
}
printf("\n");
}
Run Code Online (Sandbox Code Playgroud) c ×1