This commit is contained in:
Geoffrey Frogeye 2016-03-09 08:36:37 +01:00
parent 5023793832
commit b225c20b2b
3 changed files with 27 additions and 2 deletions

View file

@ -55,7 +55,5 @@ int main() {
printf("Résultat : %d\n", res);
return 0;
}

View file

@ -33,4 +33,5 @@ int main() {
}
printf("Moyenne : %lf\n", moyenne(n, T));
printf("Maximum : %lf\n", maximum(n, T));
return 0;
}

26
TP3/E4.c Normal file
View file

@ -0,0 +1,26 @@
/* Recherche d'éléments sur critère */
#include <stdio.h>
int recherche(int n, double T[n]) {
int i;
for (i = 0; i < n; i++) {
if (T[i] < 0) {
return i;
}
}
return -1;
}
int main() {
int n, i;
printf("Nombre de nombres ? ");
scanf("%d", &n);
double T[n];
for (i = 0; i < n; i++) {
printf("Saisir le nombre %d : ", i+1);
scanf("%lf", &T[i]);
}
printf("Recherche : %lf\n", recherche(n, T)+1);
return 0;
}