+ 5
But how would you keep track of the number of inputs from the user provided that you have a flag to tell you the end of input
2 Antworten
+ 2
I guess you mean about https://www.sololearn.com/Discuss/250257/?ref=app
Think of an infinite loop that:
- accepts user input
- checks whether the entered value is some flag (e.g. "-1")
- if the value is that flag, exit the loop
- if not, add the value to the running sum, and increment by 1 the number of entries
+ 1
I suggest you use a count e.g
Count = 0
While != stopped {
/** you code here */
Count++;
}
display (count);