1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
UNO [17]
3 years ago
11

What are the values of i and j after the following code snippet is run? int i = 10; int j = 20; int count = 0; while (count <

5) { i = i + i; i = i + 1; j = j - 1; j = j - j; count++; } System.out.println("i = " + i + ", j = " + j);
Mathematics
1 answer:
AlexFokin [52]3 years ago
6 0

Answer:

i = 351, j = 0

Step-by-step explanation:

The while loop runs 5 times as indicated by the variable, count.

The variable, i, has an initial value of 10. The first line of the loop code doubles the value of i while the second increments it by 1. This is done 5 times. We have

Iteration 1: i = 10 + 10 + 1 = 21

Iteration 1: i = 21 + 21 + 1 = 43

Iteration 1: i = 43 + 43 + 1 = 87

Iteration 1: i = 87 + 87 + 1 = 175

Iteration 1: i = 175 + 175 + 1 = 351

The third line of the loop code decrements j by 1. However, the fourth line sets j = 0 by subtracting it from itself. Hence, j is always 0 at the end of the loop, no matter its initial value or the number of iterations.

Thus, at the end of the code snippet, i = 351 and j = 0.

You might be interested in
David likes to enter bike races on weekends. He can bike 42 ½ miles in 2 ½ hours. How many miles can he ride in just one hour? g
Rudiy27

Answer:

17 miles in 1 hour

Step-by-step explanation:

4 0
3 years ago
Read 2 more answers
CAn you help me with ratios? Mrs. Sturkie mixed 3 quarts of blue paint and 2 quarts of red paint to make purple paint to her cla
fredd [130]
So as we already know the ratio is 3 quarts blue paint to 2 quarts red paint, also written as 3:2. if she only has 1 quart blue paint she will need half of a quart of red paint because the ratio has to remain the same amount. if you multiply one side then you must multiply the other. same goes with division. If she only has 1 quart of red paint then that shows she divided the 2 red by 2. There fore you would have to divided the 3 by 2 in order to get 1.5 which would then make the ratio 1.5:1
3 0
3 years ago
x= infinity; 9x to the power of 3 + x to the power of 2 - 5 divided by 3x to the power of 4 + 4x to the power of 2
Delvig [45]

Answer:

here n Hope it helps. goodluck

5 0
2 years ago
(I WILL MARK BRAINLYIEST ONLY IF CORRECT)The first five terms of a pattern are given below. 36,38,40,42,44 which expression can
nekit [7.7K]

Answer:

D

Step-by-step explanation:

5 0
3 years ago
Read 2 more answers
I need help with question 1, 2, 6, 7 and 8.
olga2289 [7]

Answer:

Step-by-step explanation:

Q1) 15+15+15+15+15+15=90

Answer : 1 over 90 as a fraction

Q2) 2 over 2

Q6) 13 over 52

6 0
3 years ago
Other questions:
  • Write another division problem that has a quotient of 3 and a remainder of 28
    14·2 answers
  • Find the slope of the line through the pair of points below.<br> (17, -10), (-17, 2)
    13·1 answer
  • What is the difference in the areas of a square and rectangle if the rectangle has side lengths 2 less and 2 more than
    7·1 answer
  • Graph the linear function p(x ) = 4x​
    6·1 answer
  • Type the correct answer in the box log's​
    11·1 answer
  • Seven subtracted from the product of 5 and a number is at least 24
    8·1 answer
  • AYUDA URGENTE! Un cultivador siembra 3/7 de su granja con maiz, y con 2/5 soya ¿en total que fraccion de la granja sembro? ¿Que
    9·1 answer
  • HELP!!! Due in 10 mins help me pls! WILL GIVE BRAINLIEST!!!
    15·2 answers
  • 10,000,000,000 is which power of ten? 21 -1 10 100
    6·1 answer
  • Which number property is illustrated in the Identy ?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!