int i,j,k;
//定义一个二维数组
int a[14][14];
int n=12;
//先将两侧的数组置为1
for (i = 1; i <= n; i++) {
a[i][1]=a[i][i]=1;
}
//中间的数字等于顶上两数之和
for (j = 3; j <=n; j++) {
for (k = 2; k<=j-1; k++) {
a[j][k] = a[j-1][k-1]+a[j-1][k];
}
}
//输出打印
for (i = 1; i<=n ; ++i) {
for ( j = 1; j <= n-i; ++j) {
printf(" ");
}
for ( k = 1; k <=i ; ++k) {
printf("%6d",a[i][k]);
}
printf("
");
}