apl/APL1.1/9.Tableaux-multidimensionnels/source/Triangle.c
unknown d9949b5cb0 a
2022-01-14 06:54:18 +01:00

83 lines
1.1 KiB
C

#include<stdio.h>
#include<stdlib.h>
<<<<<<< HEAD
#define LIMITE 30
=======
#define LIMITE 30
>>>>>>> 9eb043aed352919d658fb0f434a13ff0f2d0f6e5
int main(void){
int compteur=0,tableauNK[1000][1000],n,k;
<<<<<<< HEAD
for(n=0;n<LIMITE;n++ ){
for(k=0;k<n;k++){
if(n>k && k>=1){
tableauNK[n][k]= tableauNK[n-1][k]+tableauNK[n-1][k-1];
} else {
if(n==k && k>=0){
tableauNK[n][k]=1;
} else if(n>=0){
tableauNK[n][k]=1;
}
}
printf("%3d",tableauNK[n][k]);
}
printf("\n");
}
=======
for(n=0;n<LIMITE;n++ ){
for(k=0;k<n;k++){
if(n>k && k>=1){
tableauNK[n][k]= tableauNK[n-1][k]+tableauNK[n-1][k-1];
} else {
if(n==k && k>=0){
tableauNK[n][k]=1;
} else {if(n>=0){
tableauNK[n][k]=1;
}
}}
printf("%10d",tableauNK[n][k]);
}
printf("n = %d\n",n);
}
printf("\n\nLA CASE 0 = %d\n", tableauNK[0][0]);
>>>>>>> 9eb043aed352919d658fb0f434a13ff0f2d0f6e5
return EXIT_SUCCESS;
}