TP4 E5
This commit is contained in:
parent
73ed29058b
commit
e7efbd99c5
22
TP4/E5.c
Normal file
22
TP4/E5.c
Normal file
|
@ -0,0 +1,22 @@
|
|||
/* Recherche de la valeur minimale */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int T[] = {90, 23, 34, 10, 56, 67, 78, 89, 12};
|
||||
int deb = 0;
|
||||
int fin = 8;
|
||||
|
||||
int *P, *minI = T + deb, min = *(minI);
|
||||
for (P = T + deb; P <= T + fin; P++) {
|
||||
if (*P < min) {
|
||||
min = *P;
|
||||
minI = P;
|
||||
}
|
||||
}
|
||||
printf("La valeur minimum est %d et est à l'indice %d.\n", min, minI-T);
|
||||
|
||||
return 0;
|
||||
}
|
Reference in a new issue