APL/Dev1.1/Tableaux/Mirroir.c
2021-10-12 17:22:38 +02:00

65 lines
904 B
C

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void){
srand(time(NULL));
int i;
int y = 0;
int w = 0;
int tab [10];
int max = 0;
int v;
int j;
int vrai;
while (y<10) {
tab[y] = rand()%101-50;
if (tab[y] > max) {
max = tab[y];
}
y=y+1;
}
for (i=0; i<10; i++){
printf("+-----");
}
printf("+");
printf("\n");
for (i=0; i<10; i++){
printf("|%4d ",tab[i]);
}
printf("|");
printf("\n");
for (i=0; i<10; i++){
printf("+-----");
}
printf("+");
printf("\n");
}
printf("%d\n",vrai);
printf("Mirroir :\n")
while (w<10) {
tab[w] = rand()%101-50;
w=w+1;
}
for (i=0; i<10; i++){
printf("+-----");
}
printf("+");
printf("\n");
for (i=9; i<=0; i--){
printf("|%4d ",tab[i]);
}
printf("|");
printf("\n");
for (i=0; i<10; i++){
printf("+-----");
}
printf("+");
printf("\n");
}
return EXIT_SUCCESS;
}