Yes, I posted the photo of the title in the question, you can see
The code looks like this
< div class = "aw - list - img >
0 Answer
Yes, I posted the photo of the title in the question, you can see
The answer part references GPT, GPT_Pro better solve the problem
The result of the above code is 0 because the variable i starts with 11, and in the do-while loop, The value of i will be increased by 2, but when 88 is greater than i, the while condition is not satisfied, the loop terminates, and the final result is the value of i, that is, 11+2+31=44, while 44 is less than 88, so the final result is 0.
The specific code is as follows:
int i = 11;
int sum = 0;
do {
sum = sum + i;
i += 2;
} while (i <= 88);
System.out.println(sum);
In the above code, we first define a variable i to store the initial value of the loop 11; Define a variable called "sum" to store the sum of the loop. Then we use a do-while loop to add the value of "sum" to the value of "i", and increment the value of "i" by 2 each time the loop is complete. When i is greater than 88, the while condition is not satisfied and the loop terminates. Finally, the value of sum is printed out.
If the answer is helpful, please accept it.
Is this code OK for this problem? Because the code itself is good, but the int can't store that much
your topic is for 88! ??
这家伙很懒,什么都没留下...