Answer to Question #191383 in Java | JSP | JSF for Hamza

Question #191383

Suppose that the input is:


38 35 71 14 -1


What is the output of the following code? Assume all variables are properly declared.


sum = 0;

num = console.nextInt();

while (num != -1)

{

sum = sum + num;

num = console.nextInt();

}

System.out.println("Sum = " + sum);


1
Expert's answer
2021-05-10T08:26:49-0400

Answer: 158


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS