Here is the problem. I need to make an array with floating point numbers, after entering the numbers, the program asks me to enter another number to search the array:

Example:

Consider the following array of floats

2.1 1 9 -14 1.3 5.9 9 17

[0] [1] [2] [3] [4] [5] [6] [7]

If the number to be searched is 5.4 the function returns –1

If the number to be searched is 9 the function returns 2

This is what I have:

What am I doing wrong?Code:#include <stdio.h> int main (void) { float ary[8]; int input; int numbers; int x; printf("Enter 8 floating point numbers: \n"); for (numbers = 0; numbers < 8; numbers++) scanf("%f", &ary[numbers]); printf("Enter the number to be searched: \n"); scanf("%f", &input); for (x = 0; x < 8; x++) { if (ary[x] == input) { printf("%d", x); } } if (ary[x] != input) { printf("-1\n"); } system ("pause"); return 0; }