30 lines
537 B
C
30 lines
537 B
C
#include<stdio.h>
|
|
#include<stdlib.h>
|
|
|
|
int main(int argc, char * argv[]) {
|
|
int table[30][30] = {};
|
|
for (int x = 0; x < 30; x++) {
|
|
for (int y = 0; y < 30; y++) {
|
|
if (y == 0 || y == x) table[x][y] = 1; else table[x][y] = 0;
|
|
}
|
|
}
|
|
|
|
for (int l = 1; l < 30; l++) {
|
|
for (int c = 1; c < l; c++) {
|
|
int t1 = table[l-1][c-1];
|
|
int t2 = table[l-1][c];
|
|
|
|
table[l][c] = t1 + t2;
|
|
}
|
|
}
|
|
|
|
for (int l = 0; l < 15; l++) {
|
|
for (int c = 0; c <= l; c++) {
|
|
printf("%4d ", table[l][c]);
|
|
}
|
|
printf("\n");
|
|
}
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|