Question: 20. Consider the following code segment. It is supposed to calculate and print the sum 1+ 2+...+ 20. int count = 0, sum =
20. Consider the following code segment. It is supposed to calculate and print the sum 1+ 2+...+ 20. int count = 0, sum = 0; while (count < 20) ( sum + count; System.out.println (sum); Which of the following statements best describes the result? A. The total printed will be correct. B. The total printed will be too small by 20. C. O is printed. D. 20 is printed. E. Nothing is printed, because the program goes into an infinite loop.
Step by Step Solution
3.42 Rating (155 Votes )
There are 3 Steps involved in it
The detailed answer for the above question is provided below T... View full answer
Get step-by-step solutions from verified subject matter experts
