Developpement/23DEV1.1/TPS1/TP01/15-Fonctions/Miroir.c

45 lines
836 B
C

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void rempalea(){
srand(time(NULL));
int i;
int n;
int tab[10];
for (i=0 ; i<10 ; i++){
n = ((rand()%101)-50);
tab[i] = n;
}
}
void tableau(){
int i;
int tab[10];
printf("\n");
printf("+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n");
for(i=0 ; i<10 ; i++){
printf("| %3d ", tab[i]);
}
printf("|\n");
printf("+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n");
}
void mirroir(){
int i;
int tab[10];
printf("\n");
printf("+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n");
for(i=0 ; i<10 ; i++){
printf("| %3d ", tab[9-i]);
}
printf("|\n");
printf("+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n");
}
int main(void) {
rempalea();
tableau();
mirroir();
return EXIT_SUCCESS;
}