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
Vsevolod [243]
3 years ago
10

EX 6.1 How many iterations will the following for loops execute? for (int i = 0; i < 20; i+ +) { } for (int i = 1; i <= 20

; i+ +) { } for (int i = 5; i < 20; i+ +) { } for (int i = 20; i > 0; i- -) { } for (int i = 1; i < 20; i = i + 2) { } for (int i = 1; i < 20; i *= 2) { }
Mathematics
1 answer:
Romashka-Z-Leto [24]3 years ago
6 0

Answer:

20, 20, 15, 20, 10, and 5 iterations respectively

Step-by-step explanation:

The loop "for (int i = 0; i < 20; i+ +)" starts at i=0 and increases the counter i by 1 at the end of each iteration. The counter must be less than 20, so the values of i in the loop are 0,1,2,3,...,19. These are 20 values, and thus the code iterated 20 times.

The loop "for (int i = 0; i < 20; i+ +)" starts at i=1 and increases the counter i by 1 at the end of each iteration. The counter can't exceed 20, so the values of i in the loop are 1,2,3,4,...,20. These are 20 values, and thus the code iterated 20 times.

Similarly, in "for (int i = 5; i < 20; i+ +)" i takes the 15 values are 5,6,7,...,19. Hence, the code iterated 15 times.

The loop "for (int i = 20; i > 0; i- -)" starts at i=20 and decreases the counter i by 1 at the end of each iteration, so the values of i in the loop are 20,19,18,...,1. These are 20 values, then we have 20 iterations.

The loop "for (int i = 1; i < 20; i = i + 2)" starts at i=1 and increases the counter i by 2 at the end of each iteration. The values of i in the loop are 1,3,5,7,...,19. These are 10 values, and thus the code iterated 10 times.

The loop "for (int i = 0; i < 20; i+ +)" starts at i=1 and multiplies the counter i by 2 at the end of each iteration, so the values of i in the loop are 1,2,4,8,16. Then we have 5 iterations.

You might be interested in
PleasehelpmeohmygodthisissohardIhavethisonmytest.okaythisquestionmightbe superduperhardsofeastyoureyesohmygodhereitisohnoidontkn
melomori [17]

Answer: 2! 1 army + 1 army = 2 Armies= BTS!!!

Step-by-step explanation:

6 0
3 years ago
Read 2 more answers
Use a graphing calculator to solve the equation 3 tan 1/3 theta
lesantik [10]
Did you get the answer

5 0
3 years ago
Read 2 more answers
Leila and jo are two of the partners in a business. Leila makes $3 in profits for every $4 that jo makes. If jo makes $60 profit
Aleonysh [2.5K]

Let

x-------> Leila 's profit

y------> Jo's profit

we know that

\frac{x}{y} =\frac{3}{4} ----------> equation 1

For y=\$60

<u>Find the value of x</u>

Substitute the value of y in the equation 1

\frac{x}{60} =\frac{3}{4}

x=60*\frac{3}{4}

x=\$45

therefore

<u>the answer is</u>

Leila make \$45 in profit

5 0
3 years ago
Read 2 more answers
HELP <br> what is the equation of the lines in slope - intercept form
34kurt

Answer:

y=7x

Step-by-step explanation:

slope intercept form is y=mx+b.

m is the slope (rise over run) and b is your y- intercept. you leave y as it is. if the line is going down, you have a negative slope. hope this helped :)

3 0
2 years ago
Suppose the p-value is 0.1038. what is the correct interpretation of this p-value in context?
Basile [38]

The p value 0.1038 represent the proportion of students who use drugs at this college is equal to 0.157, the probability of getting a statistic as extreme or more extreme as that observed is 0.1038.

According to the statement

we have given that the P value and we have to find the correct interpretation of this p-value in context.

So, For this purpose, we know that the

The P - Value is the In null-hypothesis significance testing, the p-value is the probability of obtaining test results at least as extreme as the result actually observed.

And in the given statement ,

The given p value is 0.1038.

And this p value is a If the proportion of students who use drugs at this college is equal to 0.157, the probability of getting a statistic as extreme or more extreme as that observed is 0.1038.

So, The p value 0.1038 represent the proportion of students who use drugs at this college is equal to 0.157, the probability of getting a statistic as extreme or more extreme as that observed is 0.1038.

Learn more about P value here

brainly.com/question/4621112

Disclaimer: This question was incomplete. Please find the full content below.

Question:

Suppose the p-value is 0.1038. What is the correct interpretation of this p-value in context?

a.) If the proportion of students who use drugs at this college is greater than 0.157, the probability of getting a statistic as extreme or more extreme as that observed is 0.1038.

b.) There is a 0.1038 probability that the proportion of students who use drugs at this college is greater than 0.157.

c.) If the proportion of students who use drugs at this college is equal to 0.157, the probability of getting a statistic as extreme or more extreme as that observed is 0.1038.

d.) There is a 0.1038 probability that the proportion of students who use drugs at this college is equal to 0.157.

#SPJ4

3 0
2 years ago
Other questions:
  • Is the ordered pair (-2,9) as a solution of the equation y=x-7
    12·1 answer
  • PLEASE HELP ME!!!!!<br> WILL NAME BRANLIEST!!
    10·1 answer
  • What is the vertex of f(x)=5^2+20-16
    10·1 answer
  • Is 12x + 24 equation to 3(4x+8
    10·1 answer
  • A runner ran 2/3 of a race in 21 minutes. They ran the entire race at a constant speed How long did it take to run the entire ra
    11·1 answer
  • I could use help with anything idc
    12·2 answers
  • Jose deposits S300 into an account that pays simple interest at a rate of 6% per year. How much interest will he be paid in the
    6·2 answers
  • Susan has 48 coins totalling $8.00 and the coins are all nickels and quarters. Which system of equations can be used to determin
    7·1 answer
  • The angle of depression from a descending airplane to the control tower below is 60∘.
    5·1 answer
  • Find the slope of the line through each pair of points. 11) (-7, 7), (-1, 1) 12) (0, -2), (-1, 4) 13) (9, 11), (-19, -8) 14) (15
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!