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

ben is showing his work in simplifying (3.9 − 9.4) − 0.6 6.1. identify any error in his work or reasoning. step 1: (3.9 − 9.4) − 0.6 6.1step 2: 3.9 (− 9.4 − 0.6
1. Miguel is buy 10 blankets for the animal shelter. If sending each blanket costs $ 1.50 and $ Miguel has 75 to spend, which is the largest amount you can spen
Can someone tell me how to find my weighed grade. I have a 97% for homework which is 15% of my grade and 84% which is 35% of grade. How do I find my weighed gra
5x-0.1=4x I need to know what X is not sure how to solve
24 ten thousands is equal to what number?
the product of 5 and twice a number
in addition to being known as a post-impressionist, gauguin was also considered a
how have don johanson and the leakeys contributed the search for early hominids?
Your body composition can be changed by altering two factors,
cells convert into atp