Developpement/23DEV1.1/TPS1/TP01/12-Tableau/Tableau-Multidimensionnel/Horizontal.c

44 lines
746 B
C

#include <stdio.h>
#include <stdlib.h>
int main(void) {
int i,j,k,l,n = 1;
int tab1[2][5];
int tab2[3][5];
int tab3[5][5];
printf(" T1 T2 T3\n");
for (i = 0 ; i < 5 ; i++){
for (j = 0 ; j < 5 ; j++){
if(i < 2){
tab1[i][j] = j + 1;
printf("%3d", tab1[i][j]);
}
else{
printf(" ");
}
}
printf(" ");
for (j = 0 ; j < 5 ; j++){
if(i<3){
tab2[i][j] = n++;
printf("%3d", tab2[i][j]);
}
else{
printf(" ");
}
}
printf(" ");
for (j = 1 ; j < 6 ; j++){
if(i<j || j == 5){
tab3[i][j] = 0;
}
else{
tab3[i][j] = j;
}
printf("%3d", tab3[i][j]);
}
printf("\n");
}
printf("\n");
return EXIT_SUCCESS;
}