杨辉三角——c语言
#include<stdio.h>
#define N 10 //自己定义输出行数
int main()
{
int a[N][N] = { 0 };
int i = 0, j = 0;
for (i = 0; i < N ; i++)
{
a[i][0] = 1;
a[i][i] = 1;
for (j = 0; j <=i; j++)
{
if(j!=0)
a[i][j] = a[i - 1][j - 1] + a[i - 1][j];
printf("%d ", a[i][j]);
}
printf("\n");
}
return 0;
}