42 lines
674 B
C
42 lines
674 B
C
#include<stdio.h>
|
|
#include<stdlib.h>
|
|
|
|
//A ignorer, incomplet.
|
|
|
|
int sum(int x) {
|
|
int somme = 0;
|
|
for (int i = 0; i <= x; i++) {
|
|
somme += i;
|
|
}
|
|
|
|
return somme;
|
|
}
|
|
|
|
int main(int argc, char * argv[]) {
|
|
int table[900] = {};
|
|
|
|
int inc = 1;
|
|
int index = 0;
|
|
for (int i = 0; i < 30; i++) {
|
|
index += inc;
|
|
table[index] = 1;
|
|
table[index+1] = 1;
|
|
inc++;
|
|
}
|
|
|
|
for (int i = 0; i < 30; i++) {
|
|
int startIndex, endIndex = sum(i+1);
|
|
startIndex = endIndex - i;
|
|
|
|
for (int j = startIndex; j <= endIndex; j++) {
|
|
if (j != startIndex && j != endIndex) {
|
|
table[j] = table[j-i] + table[j-i-1];
|
|
}
|
|
printf("%3d ", table[j]);
|
|
}
|
|
printf("\n");
|
|
}
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|