+ 1
why sum =0
3 ответов
+ 6
simply because sum will have garbage value in it before you put anything. If your variable sum has garbage(random number) your addition will go wrong. thats why sum = 0
+ 2
if u use int sum instead of int sum = 0
sum+=... will cause error
+ 1
this is because we are declaring the initial value of sum which will increase as vsriables are added to it.