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]
4 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]4 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
Students are voting for a Friday Funday activity. 0.84 want a movie and snack. There are 300 voters. How many votes does the win
erastova [34]

Answer:

Step-by-step explanation:

0.84(300)=252

3 0
3 years ago
Plz help me with this and u can change the slide too
Nadusha1986 [10]
The 1 slide it is intersecting the second slide is the 4x-y=5 slide 3 is the same and 4th slide is different
4 0
3 years ago
F(2)if f(x)=2x-5 plz answer
Lena [83]

Answer:

-1

you use the given functions to set up and simplify f(2)

7 0
3 years ago
Can someone Help me in this problem?
Fed [463]
If you have to write the equation then it would be "5k + 6.7"
5 0
3 years ago
a leaky faucet is losing water and it is filling a 5 gallon bucket every 12 hours. At the rate, how many gallons of water will t
Alina [70]

Answer:

20 gallons

Step-by-step explanation:

First start off by dividing 48 by 12 to see how many times 12 goes into 48.

48 / 12 = 4

now that you know that 12 goes into 48 4 times, multiply 4 by 5 to see how many gallons the leaky faucet will fill in 48 hours.

4 x 5 = 20

therefore the answer is 20 gallons

I hope this helps ^^

3 0
3 years ago
Other questions:
  • PLEASE HELP ME! I NEED HELP ASAP! EXPLAIN THE ANSWER!! PLEASEE I WILL MARK BRAINLIEST! HELP ASAP!!
    8·1 answer
  • What is f(x)=x3+2x2−5x−6 in factored form given that 2 is a zero of the function?
    10·2 answers
  • What is the answer for number 7
    15·1 answer
  • You wish to take out a $375,000 mortgage. The yearly interest rate on the loan is 3% and the loan is for 25 years. How much will
    11·1 answer
  • One number is 10 times as large as another, and their difference is 81. Find the numbers.
    7·2 answers
  • F(x)=x^2. what is g(x)?
    11·1 answer
  • How to find the slope of a line parependicualr to another lie]?
    6·1 answer
  • Help me I need help!
    9·1 answer
  • Find the area of a regular hexagon
    7·2 answers
  • What must happen to make harvesting electricity possible??
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!