Hint: 3/4 equals 0
Tim S.
Hint: 3/4 equals 0
Tim S.
Don't put your functions inside main.
It is, but your local variable overrides the global symbol, so inside that function, sum is just a plain int. Rename it to total or some such.
You need a semicolons not commas.12: for(i=0, i < count, i ++)
Line 12: error: expected ';' before ')' token
Line 12: error: expected expression before ')' token
what's wrong with for(i=0, i < count, i ++)
Yes, since you're dividing it by count, which is another int, you end up with integer division, which is very inaccurate. Basically it divides and gives you the whole number part, discarding the remainder. You could change it to a float/double or just cast one of the two operands to a float or double.