DEV/DEV1.1/TP06:Tableaux/maximum.c
2022-10-12 16:41:36 +02:00

22 lines
499 B
C

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
int i;
int max;
int tab[10];
srand(time(NULL));
for (i=0;i<10;i++){
tab[i]=((rand()%101)-50);
} printf("+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n");
max=tab[0];
for (i=0;i<10;i++){
printf("| %3d ",tab[i]);
if (max<tab[i]){
max=tab[i];
}
} printf("|\n+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+\n");
printf("Le plus gans element du tableaux est %d\n",max);
return 0;
}