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
Can someone please help me with this question please please help me I really really need help please.
harina [27]

Answer:

1st : neither linear nor nonlinear

2nd: nonlinear

3rd: linear

4th: both linear and nonlinear

4 0
3 years ago
Problema 3
Serjik [45]

espero y te ayude, cualquier cosa escríbeme

4 0
3 years ago
Four friends own a car wash. The total profit in the first month was $438$438. In two months, each of the friends had made a pro
goblinko [34]
If you  take 438 divided by 4 = 109.5 109.5 + 74.5 = 184 74.5 x 4 = 298
4 0
3 years ago
Find the value of x in the given
qwelly [4]

Answer:

x=8

Step-by-step explanation:

3 0
3 years ago
What's an equivalent expression for  16x − 8.
AveGali [126]
Both 16 and 8 have a common factor which is 8, so divide both numbers by 8, and you get 2x-1, which is equivalent to 16x-8
6 0
3 years ago
Read 2 more answers
Other questions:
  • 20% off $339 what is the answer help me
    9·2 answers
  • Frank is building a table. He needs 4 pieces of wood for the table legs. Each piece of wood needs to be 7/8 of a foot long. What
    5·1 answer
  • find rodrigos percent increase or decrease in sales each week. week 1, is 17 wwek 2, is 25 week 3, is 18 and week 4, is 27. his
    15·1 answer
  • Xsquared -5x= 2x-6 what is the solution
    9·2 answers
  • . Whats The Mean Price Per Gallon Of Milk??
    12·1 answer
  • If an airplane in a 1/4in. Scale drawing is 5in. Long, how long is the actual airplane?
    8·1 answer
  • Need help with us question
    13·1 answer
  • Hi i need help asap my parent taught me how to do this equation (x^2-4x)^2+7x^2-28x+12=0 but i still dont understand I really ne
    14·1 answer
  • Translate the statement into an equation or inequality. The sum of 5 and a number is less than the product of the number and 7 m
    14·1 answer
  • Does the table represent a linear function? Why or why not.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!