soccerstar8916 soccerstar8916
  • 18-10-2019
  • Computers and Technology
contestada

The following code snippet will output the value of 44. int a = 0; int total = 0; do { total = total + a; a++; } while (a < 10); System.out.println(total); Select one: True False

Respuesta :

ExieFansler ExieFansler
  • 18-10-2019

Answer:

False.

Explanation:

What the code does is it calculates the sum of integers from 0 to 9 and prints it.

In the code a total variable is declared and initialized with the value 0.Then the do while loop is used to calculate the sum by storing it in the total variable.

This code will print 45 because the sum from 0 to 9 is 45.It will not add 10 because after adding 9 to total the value of a is updates it becomes 10 and it is checked the loop condition fails.

Answer Link

Otras preguntas

name two elements that you would expect to have properties very much like those of calcium
what it means taking 2 vitamin daily
−2/9−(−1/3÷3/5) what the answer symplefied I mark brainlyest
I need to know what it means.
Who did the palestinian terrorists take hostages during the munich massacre?
which triangles are congruent by ASA?
Four farmers are picking apples in an orchard. Farmer A picks 3/8 of the apples, Farmer B picks 22% of the apples, Farmer C picks 0.29 of the apples, and Farmer
Which reactions in glycolysis are physiologically irreversible?
Which President ended American involvement in the Vietnam War? Lyndon Johnson Richard Nixon John F. Kennedy Dwight Eisenhower
Use each of the two words below in a sentence that shows their meaning in this lesson. a. depression b. manumission