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
Bus math 2 ch6 test help pls
Klio2033 [76]

Answer:

$9.47

Step-by-step explanation:

Add all her purchases together

97.62 + 22.95 + 14.78 = 135.35

The total tax is 6.5% sales tax, and 0.5% country tax

6.5% + 0.5% = 7%

Multiply the total amount spent by the total tax

Remembering that you need to convert the 7% into an integer, by simply diving by 100 first

135.35 * 0.07 = 9.47

5 0
3 years ago
A basketball scout has developed a screening tool to identify future NBA all-stars. The screening tool is fairly reliable; 95% o
Over [174]

Answer:

The value is P(F) =0.0095

Step-by-step explanation:

From the question we are told that

    The  probability that a player is  being identified as an NBA all-stars is 95% = 0.95

     The number of player in the camp is  n =  100

Generally the probability that a player becomes the first person to be evaluated is mathematically represented as

         p(1) = \frac{1}{n}

=>      p(1) = \frac{1}{100}

=>     p(1) = 0.01

Generally the probability that the first basketball player his screening tool identifies as a future NBA all-star is truly a future NBA all-star

      P(F) =  P(1) *  0.95

=>    P(F) =0.01 * 0.95

=>    P(F) =0.0095

             

3 0
3 years ago
Gavin and Jack are practicing shots against their goalie. On their last 15 attempts, Gavin made 6 and Jack made 7. Based on this
statuscvo [17]

Answer:

\dfrac{14}{75}

Step-by-step explanation:

Gavin made 6 out of 15 shots, so the probability that Gavin's next shot will be  successful is

\dfrac{6}{15}=\dfrac{2}{5}

Jack made 7 out of 15 shots, so the probability that Jack's next shot will be  successful is

\dfrac{7}{15}

The probability that they both make their next shot successfully is

\dfrac{2}{5}\cdot \dfrac{7}{15}=\dfrac{14}{75}

5 0
3 years ago
Write two expressions whose sum is x-3/x+2, I need help it is confusing for me.
lara [203]
\bf \cfrac{x}{x+2}~~-~~\cfrac{3}{x+2}\impliedby \textit{since the LCD is }x+2\implies \cfrac{x-3}{x+2}
6 0
3 years ago
Please Help me Please please please ​
Vesna [10]

Answer:

The answer is,

(8+2+6) ft = 16 ft

3 0
2 years ago
Other questions:
  • A number y increased by 5 is at most 28​
    14·2 answers
  • Which expression is equivalent tos cos(3x)sinx
    5·2 answers
  • Define identity term
    10·2 answers
  • Megan finds a bag of 24 craft bows at the store. The bag indicates that 23 of the bows are striped. Megan wants to know the numb
    10·1 answer
  • What is the answer to 4x1/5=
    12·2 answers
  • the health food store wishes to blend peanuts that cost $1.20/ib with raisins that cost $2.10/ib to make 50 pounds of a mixture
    10·1 answer
  • Help please with the screenshot below
    12·1 answer
  • HELP ME FAST!!!!!!!!!!!​
    11·1 answer
  • Each week, Stephanie is paid a $180 base salary and a 3% commission on her total sales generated for the week. Which expression
    14·1 answer
  • What is 2/9 ÷ 1/2 ???
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!