DEV/DEV1.1/TP11:Debogueur/miroir.c

29 lines
705 B
C
Raw Permalink Normal View History

2022-11-15 11:20:58 +01:00
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
int i;
int j;
int k;
int tab[10];
srand(time(NULL));
for (i=0;i<10;i++){
tab[i]=((rand()%101)-50);
} printf("+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n");
for (i=0;i<10;i++){
printf("| %3d ",tab[i]);
} printf("|\n+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n");
printf("Voici le tableaux inverse:\n+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n");
i=9;
for(j=0;j<5;j++){
k=tab[j];
tab[j]=tab[i];
tab[i]=k;
i--;
}
for (i=0;i<10;i++){
printf("| %3d ",tab[i]);
} printf("|\n+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n");
return 0;
}