APL/APL1.1/TP11/remplissage.c
2021-10-05 16:17:21 +02:00

32 lines
513 B
C

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main(int argc, char * argv[]) {
int tab[10] = {};
srand(time(NULL));
int rand_v = rand();
for (int i = 0; i < 10; i++) {
srand(rand_v);
tab[i] = rand() % 101 > 50 ? (-rand() % 100) + 50: (rand() % 100) - 50;
rand_v = rand();
printf("+-----");
}
printf("+\n");
for (int i = 0; i < 10; i++) {
printf("| %3d ", tab[i]);
}
printf("|\n");
for (int i = 0; i < 10; i++) {
printf("+-----");
}
printf("+\n");
return EXIT_SUCCESS;
}