#include <stdio.h>
#define N 6
int main(void)
{
int a[N][N];
int i,j;
for(i=0;i<N;i++)
for(j=0;j<=i;j++)
{
if(i==j){a[i][j]=1;printf("1 \n");continue;}
if(j==0){a[i][j]=1;printf("1 ");continue;}
a[i][j]=a[i-1][j-1]+a[i-1][j];
printf("%-7d",a[i][j]);
}
return 0;
}
根据上面各位前辈的提示,我也写了下,嘿嘿~