37 lines
473 B
C
37 lines
473 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
int main(void){
|
||
|
int tab1[30][30]={0};
|
||
|
int i;
|
||
|
int j;
|
||
|
int nb=1;
|
||
|
for(i=0;i<30;i++){
|
||
|
for(j=0;j<nb;j++){
|
||
|
if(j>0&&i>0){
|
||
|
tab1[i][j]=tab1[i-1][j]+tab1[i-1][j-1];
|
||
|
}
|
||
|
else{
|
||
|
if(i==0){
|
||
|
tab1[i][j]=1;
|
||
|
}
|
||
|
else{
|
||
|
if(j>=0){
|
||
|
tab1[i][j]=1;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
nb++;
|
||
|
}
|
||
|
nb = 1;
|
||
|
for(i=0;i<30;i++){
|
||
|
for(j=0;j<nb;j++){
|
||
|
printf("%5d",tab1[i][j]);
|
||
|
}
|
||
|
printf("\n");
|
||
|
nb++;
|
||
|
}
|
||
|
|
||
|
return EXIT_SUCCESS;
|
||
|
}
|