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

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

1 Expert Approved Answer
Step: 1 Unlock

The detailed answer for the above question is provided below T... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!