#include #include #include int main(void){ int NOMBRE = 5; double CIBLE = 51.7; double tab[NOMBRE]; int i; double res = 100000; int proche = 0; for(i = 0; i< NOMBRE; i++){ printf("Entrez une valeur : "); scanf("%lf", &tab[i]); printf("case n° %d : ", i); printf("%.2lf\n", tab[i]); } res = fabs(tab[0] - CIBLE); for(i = 1; i < NOMBRE; i++){ if (fabs(tab[i] - CIBLE) <= res){ res = fabs(tab[i] - CIBLE); proche = i; } } printf("La valeur la plus proche est dans la case n° %d\n", proche); return 0; }