Solved

Write a Code Fragment That Allows a User to Continue

Question 27

Essay

Write a code fragment that allows a user to continue inputting numbers until she enters a sentinel value of 0. Then print the sum of all the numbers she entered. You may assume that a Scanner object called input has already been created.

Correct Answer:

verifed

Verified

int sum = 0;
int inputInt;
do {
System.o...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions