So within my program I have written a function that finds the range of a set of numbers, unfortunately it doesn't seem to be working correctly. Instead of giving me the difference between the smallest number and the biggest number, its giving me this:
I've looked all over the internet, and while I found a couple useful examples of how to do it, they didn't seem to fix this problem. Here is my function, if anyone needs to see the entire code, just let me know.
I've tried everything I can think of, any suggestions
Code:
(3) Range
(4) Restart/Exit
3
7900455959466841600000000000000000.0
Code:
float range(float numbers[], int amount)
{
int i;
float diff=0;
for (i=1;i<=amount;i++){
diff=numbers[amount]-numbers[1];
}
printf("%.1f",diff);
return diff;
}