It appears you didn't read the "Hints before you make a post" thread. That's rude, because you have posted code that has lost its formatting and is difficult to read; yet, you want voluntary help. Please rectify that oversight. Furthermore, you haven't said what your exact problem is with your code. We are not mind readers. Information is key. You can get some from error messages, you can get some from your debugger, you can get some by sprinkling output statements in the area where you are having problems.

No, you don't need a linked list; an array would do just fine, if you plan to sum them AFTER the read, as you're doing now. You could also sum them during the read, if you had no further use for the individual components. You won't get a sum with "sum_x = x". That will just replace the value of sum_x with the value of x each time. You need to use "sum_x += x", which is shorthand for "sum_x = sum_x + x." In any event, as mentioned above, the x has to be the input series, which means do it as you read, or store the entire series in an array.