Question: I ' m having trouble with only reading 1 integer from a line. Using the example output I get 1 5 instead of 1 1

I'm having trouble with only reading 1 integer from a line. Using the example output I get 15 instead of 11. The question is below. Thanks!
In sum_integers.c complete the sum_integers function. The function asks the user to enter a series of integers, reads one per line, stops reading when a non-integer is entered,
and returns the sum of the integers read. Example:
Enter integers, one per line:
1?
2?
34
5?
q
should return the sum 11.
Note that excess values on a line are ignored.
I ' m having trouble with only reading 1 integer

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!