Originally Posted by tzuchan
Essentially, when you loop and run the scanf to num, you clear out anything that was originally stored in the num variable... that includes the sum of previous data(not that it actually sums it up...)
so what will happen is that let's say the last value entered by the user is 300.0, it hits the num +=num line. expanding and substituting the values in get me num = 300.0 + 300.0;
meaning num == 600.0...
hit the divide part, assuming MAX == 30, avg = 600.0/30 == 20.0... Hardly the average of all values entered.
There's also the fact that it was supposed to be a user defined amount of data entered, not a fixed amount...