Suppose sum and num are int variables, and the input is
20 25 10 18 -1
What is the output of the following code? (Assume that console is a Scanner object initialized to the standard input device.)
sum = 0;num = console.nextInt();while (num != -1){ if (num >= 20) sum = sum + num; else sum = sum - num; num = console.nextInt();}System.out.println(sum);
A. 17
B. 28
C. 45
D. 60
Answer: A
You might also like to view...
Tax preparation software helps companies record and report their financial transactions.
Answer the following statement true (T) or false (F)
The CSS relative positioning property called ____ moves the element the specified distance from the top edge of the closest ancestor element that is also positioned; the default value, 0, leaves the element in its original vertical position.
A. edge B. top C. upper D. bottom
A database analyst collects and analyzes evidence found on computers, networks, mobile devices, and databases.
Answer the following statement true (T) or false (F)
When a digital signal is being transmitted, the rises and falls of the signal can start to shift, or become blurry, and thus produce ____________________.?
Fill in the blank(s) with the appropriate word(s).