emilyrivera2002 emilyrivera2002
  • 21-09-2021
  • Computers and Technology
contestada

4. What is the output of the following C++ code?
int num = 1;
while (num * num <= 50)
{
cout << num << " ";
num = num + 2;
}
cout << endl;

Respuesta :

Аноним Аноним
  • 21-09-2021

Answer:

3 5 7 9

Explanation:

First, integer 1 is stored in variable num.

In the while statement, the condition is 1*1 <=50 (Which is true)

If that condition is met, we add 2 to variable num, resulting in 3.

The condition fails at 8 because 8*8 is 64, but the condition is met at 7*7 which is 49 and then we add 2 in variable num, resulting in 9.

Answer Link

Otras preguntas

What must you do to create a compelling argument that people want to read?
What are the factors of 36x8 – 49? (9x4 – 1)(4x2 + 49) (36x4 – 7)(x2 + 7) (6x4 – 7)(6x4 + 7) (6x8 – 7)(6x + 7)
Ferns and mosses are alike in what they can reproduce sexually only when
find the unique value of y =3x-2
How many atoms of carbon are in the sample
Keratin has a square tile.the perimeter of the tile is 32 inches.what is the length of each side of the tile?
Which of the following is not a congruence transformation? A) a reflection over the axis b) a dilation with scale factor 0.5 c) a translation 1 unit left d) a d
The US economy after World War I relied in large part on
Write 720/2000 as a product of prime factors and simplify
Write one new word that can be made from each of the following root words.