You're not checking that fscanf
actually finds a number. The last call will fail because you're most likely just reading in the last line break in the file.
Try this:
do
{
if (fscanf(filePtr, "%d", &input)==1) {
total = total + input;
count++;
}
} while (!feof(filePtr));
EDIT: @Andrew is right — you should really check for an EOF at the top of the loop:
while (!feof(filePtr)) {
/* ... */
}