Suppose sum and num are int variables, and the input is
18 25 61 6 - 1
What is the output of the following code?
Scanner cin = new Scanner (System. in); sum = 0; num = cin. nextInt (); while (num! = - 1) {sum = sum + num; num = cin. nextInt (); }System. out. println (sum);
+5
Answers (1)
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Suppose sum and num are int variables, and the input is 18 25 61 6 - 1 What is the output of the following code? Scanner cin = new Scanner ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Home » Computers & Technology » Suppose sum and num are int variables, and the input is 18 25 61 6 - 1 What is the output of the following code? Scanner cin = new Scanner (System. in); sum = 0; num = cin. nextInt (); while (num! = - 1) {sum = sum + num; num = cin.