I the purpose of this program is to add 1 to 100, and is something wrong? Have a great spirit to give directions? A freshman C language for beginners!
CodePudding user response:
I want to know you I was used to record what of,
If I were starting position, so I=1, the output is 5050, and the answer is right,
# include & lt; Stdio. H>
Void main () { Int I, sum=0; Printf (" please enter an I value "); The scanf (" % d ", & amp; i); While (i<{ =100)Sum=I + sum; i++; } Printf (" sum=% d ", sum); }
If I was terminated position, so I=100, when the answer 5050.
# include & lt; Stdio. H>
Void main () { Int I, sum=0; Printf (" please enter an I value "); The scanf (" % d ", & amp; i); While (I) { The sum +=I; I -; } Printf (" sum=% d ", sum); }