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

70 lines
1.1 KiB
C
Raw Normal View History

2024-12-09 11:53:11 +01:00
#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];
for (i = 0 ; i < 2 ; i++){
for (j = 0 ; j < 5 ; j++){
tab1[i][j] = j + 1;
printf("%3d", tab1[i][j]);
}
printf("\n");
}
printf("\n");
for (i = 0 ; i < 3 ; i++){
for (j = 0 ; j < 5 ; j++){
tab2[i][j] = n++;
printf("%3d", tab2[i][j]);
}
printf("\n");
}
n = 1;
printf("\n");
for (i = 0 ; i < 5 ; i++){
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");
for (i = 0 ; i < 5 ; i++){
for (j = 0 ; j < 2 ; j++){
tab1[i][j] = j + 1;
printf("%3d", tab1[i][j]);
}
printf("\n");
}
printf("\n");
for (i = 0 ; i < 5 ; i++){
for (j = 0 ; j < 3 ; j++){
tab2[i][j] = n++;
printf("%3d", tab2[i][j]);
}
printf("\n");
}
n = 1;
printf("\n");
for (i = 0 ; i < 5 ; i++){
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;
}