What should we do if this fails ?  If I ask you for the mean of [ 1, 2, 3, 4, "five", "six", 7, 8, 9, 10 ] I think I should get an error, not the mean of the numeric entries in the list.
Also: the test should be 1 == sscanf(...), since this means x got written; and sscanf can return EOF, i.e. -1, which is true on error, in which case you'll use the uninitialized value of x in arithmetic, below !