+ 2
Why x++ before adding sum += ... ?? Thought it starts with zero not with one?
..
9 Respostas
+ 8
if you have sum += x++; than it's ok because x++ eveluate exspression and then increment value.
In other case this will work good:
sum += x;
x++;
+ 2
don't want other languages but ty
+ 2
ooooooooohhhhhh thank you 😊
0
int [ ] myArr = {6, 42, 3, 7};
int sum=0;
for(int x=0; x<myArr.length; x++) {
sum += myArr[x];
}
System.out.println(sum);
0
that's the program I have
0
and there i have X++ and then sum+=myArr[X]
0
okay why isn't it at that point??