DEV1.1
SAE1.1
TP01
TP02
TP05
TP06
TP07
TP08
TP09
TP10
TP11
TP12
maximum.c
recherche.c
remplissage.c
TP13
TP14
TP15
TP16
TP17
essai_ctrl_m
SAé1.1
.gitignore
README.md
30 lines
522 B
C
30 lines
522 B
C
![]() |
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <time.h>
|
||
|
#include <math.h>
|
||
|
|
||
|
int main(void) {
|
||
|
int tableau[10];
|
||
|
int i;
|
||
|
int n_max;
|
||
|
int index_precedent;
|
||
|
srand(time(NULL));
|
||
|
for(i=0; i<10;i++){
|
||
|
tableau[i]= (rand()%101)-50;
|
||
|
printf("%d\n", tableau[i]);
|
||
|
if (i==0){
|
||
|
index_precedent = i;
|
||
|
n_max = tableau[i];
|
||
|
}
|
||
|
else {
|
||
|
index_precedent = i-1;
|
||
|
if (tableau[i]>n_max){
|
||
|
n_max = tableau[i];
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
printf("Le plus grand élément du tableau est %d.\n", n_max);
|
||
|
}
|