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

How do you say I am sleepy in spanish?
The ratio of X to 40 is 1 to 2. What is the value of X?A)1B) 10C) 20D) 80​
From what direction would you travel to get from Mexico to Cuba?​
1. The heights of two right prisms are 18 ft. and 30 ft. The bases are squares with sides 8 ft. and 15 ft., respectively. Are the prisms similar? Explain your r
y=7600(1.01)^x What is the percentage rate of increase or decrease.
Select the correct locations on the image. In which four locations do hurricanes occur? this isn't really a question its more of an answer for u guys who need i
HELP PLEASE DUE IN 4 MINUTES
Most bacteria are surrounded by a rigid protective structure called the _____. •cell wall •cell membrane •flagellum •protein coat
could someone maybe help me with this ?
What was the impact of the internment? (interment camps)