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
Given f (g (x)) = x + 4 and f (x) = 3x + 5, find g (x).​
JulijaS [17]

Answer:

g(x) = \frac{1}{3}(x - 1) = \frac{x}{3} - \frac{1}{3}

Step-by-step explanation:

f(x) = 3x + 5

f[g(x)] = 3[g(x)] + 5

⇒  3[g(x)] + 5 = x + 4

⇒  3[g(x)] = x + 4 - 5

⇒  3[g(x)] = x - 1

⇒  g(x) = \frac{1}{3}(x - 1) = \frac{x}{3} - \frac{1}{3}

5 0
2 years ago
a rectangle has an area of 1/6 squar centimeters and a length of 1.5 centimeters what is the width and the perimeter
Alex73 [517]
<span>

(1/6)/ 1.5 = 
(1/6)/(15/10)=
1/6*10/15=10/90=1/9 width</span>
3 0
3 years ago
Need help on this question
sergey [27]
Total Area: T.A.=2*Ab+Al

Area of the base: Ab=p*K

Semi-perimeter of the base: p
p=P/2
Perimeter of the base: P=20
p=P/2=20/2→p=10
Ab=p*k=10*K→Ab=10K

Lateral Area of the prism: Al
Al=P*h
Height of the prism: h=6
Al=P*h=20*6→
Al=120

T.A.=2*Ab+Al
T.A.=2*(10K)+120
T.A.=20K+120
T.A.=120+20K

Answer: (120+20K)



7 0
3 years ago
What is the value of 4C9 ?
vekshin1
The answer is 0

The formula is

n!/ r!(n-r)!

4!/ 9!(4-9)!
7 0
2 years ago
5 questions plz answer asap:)
Flauer [41]
5. bxh divided by 2
so 16 x 6=96


96 divided by 2 = 48


7 0
2 years ago
Read 2 more answers
Other questions:
  • Write the rule for the table below help me pleaseeeeeeeeee
    15·1 answer
  • Find the 1st- 4th nTH term and then find the 10th term, rule is 5-2n
    5·1 answer
  • Find the value of x in this polygon.
    9·1 answer
  • An exponential model shows the growth of a towns population in years. Identify the parts:
    7·1 answer
  • Find the slope of the graphed line
    14·1 answer
  • Help ASAP please....
    13·2 answers
  • Erik used the Factor Theorem to find the remainder of 2x3-4x2-28x+6 divided by x+3. If he calculated the remainder to be 0, what
    15·1 answer
  • Hello can anyone help me with this question please and thank you
    8·1 answer
  • A square room has a floor area of 25 meters. the height is 3 meters what is the area of one wall
    10·2 answers
  • PLSSS HELP HURRRYYYYY (100 POINTS ) CLICK ON THE PICTURE
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!