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
valentinak56 [21]
2 years ago
9

What is the result when the following code is run? double x = 1; double y = 1; int i = 0; do { y = x / 2; x = x + y; i = i + 1;

} while (x < 2.5); System.out.print(i + " ");
Mathematics
1 answer:
Mama L [17]2 years ago
6 0

Answer:

The answer is: 3

Step-by-step explanation:

1. At the begining of the program we start by declairing the variables:

 double x=1, double y=1 and int i=0.

2. The structure do...while is used to defined the loop. x<2.5 is the finalization condition of the loop. i is the counter of the loop.

y=x/2 is the first calculation

x=x+y is the second one. Here is where the values of the variable x changes.

a) for the first iteration, the values of y and x are shown below:

\\\\x=1\\y=1\\y=1/2=0.5\\x=1+0.5=1.5\\i=1

The variable x is minor to 2.5 so the loop will continue computing.

b)   the second iteration, the values of y and x are shown below::

 y=0.5\\x=1.5\\y=\frac{1.5}{2}=0.75\\ x=1.5+0.75=2.25\\i=2

The variable x is still minor to 2.5 so the loop will continue computing.

c) third iteration:

y=0.75\\x=2.25\\y=\frac{2.25}{2} =1.1125\\x=2.25+1.125=3.375\\i=3

The condition x<2.5 is not true so the loop ends.

3. System.out.print(i + " "); displays the value of the variable i wich value is 3.

Therefore the number 3 is display.

You might be interested in
A b
kumpel [21]
The constant of proportionality is 4. Also, look at 36, and 9 because you could have just divided it it is not as complicated as you think.
5 0
2 years ago
if <img src="https://tex.z-dn.net/?f=h%28x%29%3D4x%5E%7B2%7D%20-16" id="TexFormula1" title="h(x)=4x^{2} -16" alt="h(x)=4x^{2} -1
Elan Coil [88]
Answer: h(x) = (2x - 14)^2 - 19

This will take the vertex from (0,-16), the original equation, to (7,-19), the new equation. This demonstrates the x-value increasing by 7, moving right on the coordinate plane, as well as the y-value decreasing by -3, going down on the coordinate plane.
6 0
2 years ago
What is the Slope in the equation y= -2x +5
cricket20 [7]

Answer:

-2

Step-by-step explanation:

y=-2x+5

y=mx+b where m=slope and b=y-intercept

4 0
2 years ago
Read 2 more answers
Fill in the rest of the table.
Vinvika [58]

9514 1404 393

Answer:

top-down

  f(g(x)) = 1, 4, 5, 3, 2

  g(f(x)) = 5, 2, 4, 1, 3

Step-by-step explanation:

To find f(g(x)), locate g(x) in the third column (labeled g(x)). Use that value as x in the first column, then read f(x) from the second column.

Example: f(g(1)) = f(2) = 1

__

To find g(f(x)), locate f(x) in the second column (labeled f(x)). Use that value as x in the first column, and read the corresponding g(x) from the third column.

Example: g(f(1)) = g(2) = 5

6 0
3 years ago
Brienne and 3 friends bought tickets to the movies. They spent a total of $27.00 on the tickets. Which equation represents this
Sindrei [870]
Hello!

The equation that represents this situation is A. 3t = 27.

Explanation:

This is because an equation is a "mathematical sentence" and this equation says that if you multiply the costs of the three friends' tickets, the total cost would be $27.
5 0
2 years ago
Other questions:
  • There are 28 students in math class, 22 of the students passed a recent test. What percentage passed the test
    6·1 answer
  • A car came to a stop from a speed of 28 m/s in a time of 2.1 seconds. What
    12·2 answers
  • If the first quadrant you start at 3,6 and move 3 units down
    10·1 answer
  • A student has 876 baseball cards. Of these cards, 91 of them portray Cincinnati Reds. If the student gives all of the Cincinnati
    7·1 answer
  • For a normal distribution with mean 47 and standard deviation 6, find the probability of obtaining a value less than 45 or great
    7·1 answer
  • The recipe for a fruit salad calls for 5 bananas, 3 peaches, 2 apples, 1 pear, 8 strawberries, 1 cantaloupe, and 2 oranges. What
    10·2 answers
  • 15w+65 factored using the GCF is???
    13·2 answers
  • HOW DO U CONVERT A DRACTION TO DECIMAL.
    13·2 answers
  • jaun has already run 6 miles this month.he plans to run an additional 2.5 miles per day. at this rate,how long will take jaun to
    15·2 answers
  • monthly payments of $75 are paid into an annuity beginning on January 31, with a yearly interest rate of 3%, compounded monthly.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!