+ 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

9th Mar 2017, 5:34 AM
Thabiso Mcd Mohlomi
Thabiso Mcd Mohlomi - avatar
2 odpowiedzi
+ 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
9th Mar 2017, 8:34 AM
Álvaro
+ 1
I suggest you use a count e.g Count = 0 While != stopped { /** you code here */ Count++; } display (count);
9th Mar 2017, 9:33 AM
Thabiso Tk Phetla
Thabiso Tk Phetla - avatar