The return value of scanf represents the number of arguments which have been successfully read, or EOF. But you're not actually reaching any EOF here, you're entering "-1" which is presumably being successfully read into the variable "number", 1 value. So scanf() is returning 1,and you're comparing it to -1, which never happens. Try comparing to the value of number, instead.
The maximum number can be calculated within the main function, whereas the average value must be calculated using a separate function callable by the main function and located within the same source file (only once source file needed). Note: the average function must have one argument only named num to pass numbers from the main function.
check your code using the following entries: 2.5, 33.1, 20, -1. If the code is correct you should get the results: maximum=20, average=18.533
I checked my code and it it still giving me a different answer: maximum = 2 and average = 2. My prof wants the average to be in a while loop and the line is a wrong statement and wants it to be changed to how a beginner should write. can someone help me please? I have been stuck on this assignment for so long.