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
How do you find compound interest and simple interest?
Goshia [24]
Step 1: Multiply the Principal, which is the amount borrowed, by the interest rate.

Step 2: Compute compound interest using the following formula: A= P(1+r/n)

Hope this helps u

6 0
3 years ago
What is the solution of the equation 6x-3 = -51?<br> А. -9<br> B. -8<br> с. 8<br> D. 9
laila [671]

Answer:

B. -8

Step-by-step explanation:

6x = -51 +3

6x = -48

x = -8

5 0
3 years ago
Read 2 more answers
Question is on picture attached
Travka [436]
  • nasa picure po yung sagot
  • #HOPE IT HELPS

8 0
2 years ago
Use the fundamental counting principle to determine all the possible outcomes from rolling a die once then spinning the spinner.
Rudik [331]
The answer is there are 6 possible outcomes: {1, 2, 3, 4, 5, 6} Hope this helps!
6 0
3 years ago
Name a transversal<br><br> Name all corresponding angles<br><br> Name all alternate exterior angles
fgiga [73]

Answer:

Name a transversal - i

Name all corresponding angles -

6 = 8

1 = 3

2 = 4

5 = 7

Name all alternate exterior angles -

1 = 5

4 = 8

7 0
3 years ago
Other questions:
  • Enter &gt; , &lt; , or = to compare the expressions.<br><br> 45/4 ? 25 - 3
    10·1 answer
  • ?????????????????(???????????
    14·1 answer
  • The perimeter of a pool table is about 7.8m. four times the length equals nine times the width. What are the dimensions of the t
    6·1 answer
  • Describe the process of factoring using the 'x' method or the 'box' method
    8·1 answer
  • What is 7 divided by 2/3? (Need this done quickly)
    12·1 answer
  • Jamoul has a life insurance policy of $150,000 that will be distributed to his 2 children and 1 grandson. If each child receives
    11·2 answers
  • Identify the constant of proportionality in the equation.
    15·2 answers
  • Witch shows the expression ordered correctly from least value to greater value a b c or d
    12·1 answer
  • Plz do this, I’m so exhausted. Thxx
    12·2 answers
  • I NEED HELP!!<br> Select correct answer
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!