hey guys so this program works by putting a number which denotes how much input is expected so lets just say i first input 5, so then i input 5 numbers like 10 20 30 40 50 and it computes the average of the 5. how do i test input of the expected and the other values as numbers? if i input any character it should display an error(havent implemented) and quit.

at first i used the ACSII values but they dont work and the statement to test it makes any input false. im not that much good in C and i just started so please give me some slack

here is the code:

Code:#include <stdio.h> int main() { int expected; int count; double sum; int value; while (scanf("%d", &expected) != EOF) { sum = 0; for (count = 0; count < expected; count++) { scanf("%d", &value); sum += value; } printf("Average of %d values is %.2f\n", count, count != 0 ? sum / count : 0.0); } }