fin horizontal

This commit is contained in:
2023-10-10 17:28:58 +02:00
parent f219823d9c
commit 3dac2edf31
3 changed files with 56 additions and 199 deletions

56
DEV1.1/TP12/horizontal2.c Normal file
View File

@@ -0,0 +1,56 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void) {
int tour,tour2,val=0,val1=0,val2=0;
int t1[2][5];
int t2[3][5];
int t3[5][5];
for (tour=0;tour<2;tour++){
for (tour2=0;tour2<5;tour2++)
t1[tour][tour2]=tour2+1;
}
for (tour=0;tour<3;tour++){
for (tour2=0;tour2<5;tour2++){
val++;
t2[tour][tour2]=val;
}
}
for (tour=0;tour<5;tour++){
for (tour2=0;tour2<5;tour2++){
if ((tour2+1)<=tour)
t3[tour][tour2]=tour2+1;
else
t3[tour][tour2]=0;
}
}
for (tour=0;tour<5;tour++){
for (tour2=0;tour2<17;tour2++){
if (tour<2){
if (tour2<5)
printf("%2d ",t1[tour][tour2]);
else if (tour2>5 && tour2<11)
printf("%2d ",t2[tour][tour2-6]);
else if (tour2>11)
printf("%2d ",t3[tour][tour2-12]);
else
printf(" ");
} else if (tour<3){
if (tour2>5 && tour2<11)
printf("%2d ",t2[tour][tour2-6]);
else if (tour2>11)
printf("%2d ",t3[tour][tour2-12]);
else
printf(" ");
} else{
if (tour2>11)
printf("%2d ",t3[tour][tour2-12]);
else
printf(" ");
}
}
printf("\n");
}
return EXIT_SUCCESS;
}