if you have a loop that asks for the user to input a value and the loop doesn't end until the sentinal, how can you keep track of all the values entered and add them together?
if you have a loop that asks for the user to input a value and the loop doesn't end until the sentinal, how can you keep track of all the values entered and add them together?
A sum and an input?
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
i.e. scanf("%d", &d)...if this is in a loop an dthe user enters values 5, 8, & 9 how do you write the language to add these together....i.e. add first loop u have 5, next loop you add 5 to 8, next loop you add 13 to 9....how do you write that?
Code:sum = 0; while ( scanf("%d", &d) == 1 ) { sum += d; }
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*