The following for loop prints the numbers 1 to 20 on one line with a space between.

for (int i = 1; i <= 20; i++)
{
System.out.print(i + " " ); // prints each value of i followed by a space on one line
}

Question

Consider the for loop example above. Assume you want to adjust the loop to print only the even values from 1 and 20. What must the loop elements - counter initialization, conditional statement, and counter modification - be set to in order to accomplish the goal.

Review all options listed below carefully. You MUST select 3 answers; one for each element/category:

Counter initialization
Conditional statement
Counter modification
a. int i = 0;
b. int i = 1;
c. int i = 2;
d. i < 20;
e. i <= 20;
f. i > 20;
g. i++;
h. i+=1-;
i. i+=2;

Answers

Answer 1

Answer:

Counter initialization: [tex]\verb!int i = 2![/tex].

Conditional statement: [tex]\verb!i <= 20![/tex].

Counter modification: [tex]\verb!i += 2![/tex].

Step-by-step explanation:

In the current Java for-loop in this question:

The counter initialization statement [tex]\verb!int i = 1![/tex] in this for-loop would initialize the counter variable to integer [tex]1[/tex]. The conditional statement [tex]\verb!i <= 20![/tex] holds as long as the counter is less than or equal to [tex]20[/tex]. Thus, the largest possible value for the counter would be [tex]20\![/tex].The counter modification statement [tex]\verb!i++![/tex] is equivalent to [tex]\verb!i += 1![/tex]. This statement would add [tex]1[/tex] to the value of the counter in each iteration.

The even integers between [tex]1[/tex] and [tex]20[/tex] includes [tex]2,\, 4,\, \dots,\, 20[/tex]. It would be necessary to add [tex]2[/tex] each time to get to the next number.

Since the list of even integers starts at [tex]2[/tex], it would be necessary to initialize the counter variable to [tex]2\![/tex] rather than [tex]1[/tex]. Thus, replace the counter initialization statement [tex]\verb!int i = 1![/tex] with [tex]\verb!int i = 2![/tex].

The maximum integer that this loop should print is still [tex]20[/tex]. Thus, the conditional statement [tex]\verb!i <= 20![/tex] does not need to be changed.

The for-loop should add [tex]2[/tex] to the counter each time to get to the next even integer. Thus, the counter modification statement [tex]\verb!i++![/tex] (or equivalently, [tex]\verb!i += 1![/tex]) should be replaced with [tex]\verb!i += 2![/tex].

Overall, the for-loop should be:

[tex]\begin{aligned}& \verb!for (int i = 2; i <= 20; i += 2) {!\\ &\quad \verb!System.out.print(i + " ");! \\ &\verb!}!\end{aligned}[/tex].


Related Questions

Please Pleaseee help...will make the brainliest

Answers

Answer:

A and F.

Explaination:

WILL GIVE BRAINLISET
Find the equation of the straight line parallel to the y-axis and pass through the point (-2, 3). _____

Answers

X + 4 = 0

Explanation

The equation of a line parallel to y axis is

x = k where k is constant. …..(1)

It is given that the line parallel to y axis passes through the point (-4,-5).

Therefore (-4,-5) will satisfy equation (1)

Hence , -4 = k

Equation (1) becomes

x = -4

=> x + 4 = 0

Hope it helps.

solve pls brainliest

Answers

its 4in^3
because its cubed

Answer:

64in

Step-by-step explanation:

v=L×W×H

= 4×4×4

= 16 ×4

= 64in²

║3x²+x+5║= 5x²- 3x+ 7

Answers

Is this what you needed ?

The product of 7 and a number is greater than 42. If the number is a whole number less than 10 , what could the number be?

Answers

Answer:

8 or 9

Step-by-step explanation:

Your primary equation that they gave you is ?b and has to be greater than ?a  7 x ?a =42

So your answer to ?a is 7 because 7 x 7 =42   therefore your answer to ?b has to be 8 or above.  

the next part of your problem states that it is a whole number UNDER 10....  this limits your possible answer to either 8 or 9.

WHAT IS THE AREA OF THE CURVED SURFACE OF A CYLINDER OF BASE RADIUS 4 CM AND HEIGHT 10 CM

Answers

Answer:

The curved surface area of cylinder is 251.42 cm².

Step-by-step explanation:

Here's the required formula to find the curved surface area of cylinder :

[tex]\star\underline{\boxed{\sf{CSA_{(Cylinder)}} = 2\pi rh}}[/tex]

Csa = Curved surface areaπ = 22/7r = radius h = height

Substituting all the given values in the formula to find the curved surface area of cylinder :

[tex]\implies{\tt{CSA_{(Cylinder)}= 2\pi rh}}[/tex]

[tex]{\implies{\tt{CSA_{(Cylinder)} = 2 \times \dfrac{22}{7} \times 4 \times 10}}}[/tex]

[tex]{\implies{\tt{CSA_{(Cylinder)} = 2 \times \dfrac{22}{7} \times 40}}}[/tex]

[tex]{\implies{\tt{CSA_{(Cylinder)} = \dfrac{2 \times 22 \times 40}{7}}}}[/tex]

[tex]{\implies{\tt{CSA_{(Cylinder)} = \dfrac{44 \times 40}{7}}}}[/tex]

[tex]{\implies{\tt{CSA_{(Cylinder)}= \dfrac{1760}{7}}}}[/tex]

[tex]{\implies{\tt{CSA_{(Cylinder)} \approx 251.42 }}}[/tex]

[tex]{\star{\underline{\boxed{\tt{\red{CSA_{(Cylinder)} \approx 251.42 \: {cm}^{2}}}}}}}[/tex]

Hence, the curved surface area of cylinder is 251.42 cm².

[tex]\rule{300}{2.5}[/tex]

The length of a rectangle is three times its width.
The perimeter of the rectangle is 24 cm.
Calculate the area of the rectangle.

Answers

Answer:

A = 27 cm²

Step-by-step explanation:

let 'w' = width

let '3w' = length

P = 2l + 2w

24 = 2(3w) + 2w

24 = 6w + 2w

24 = 8w

w = 3

l = 3(3) or 0

A = lw

A = 3(9)

A = 27

−56z+28minus, 56, z, plus, 28?

Answers

Answer-

Not quite sure what your asking but the if I understood correctly the answer is -122z+56

Answer:

−112z+56

Step-by-step explanation:

−56z+28−56z+28

Combine −56z and −56z to get −112z.

−112z+28+28

Add 28 and 28 to get 56.

−112z+56

Please help I need to show my work

Answers

is your test online or on paper? how would you show work. i’ll comment the answer on this

Help me guys!

Fill in the table using this function rule.

y = -2x+3

Answers

Y=-2(-6)+3
Y=12+3
Y=15

Y=-2(-3)+3
Y=6+3
Y=9

Y=-2(0)+3
Y=0+3
Y=3

Y=-2(3)+3
Y=-6+3
Y=-3

Y=15
Y=9
Y=3
Y=-3

help please i dont get it

Answers

Answer:

Well apparently you don't know your Alphabet

Step-by-step explanation:

So it is

A.B.C.D.E.F.G.H.I.J.K.

The correct order is ABCH.

What is Order of Letters?

Arrangement according to the normal order of the letters in the alphabet.

Given that a puzzle

The correct order of alphabets to reach the key is ABCH.

Hence, the answer is ABCH.

For more references on Order of Letters, click;

https://brainly.com/question/1480667

#SPJ2

What is 8.798 rounded to the nearest cent

Answers

Answer:

For some reason i couldn't add an answer, but it 8.80 because 9 was rounded to 10 and changed the 7 to 8.

Step-by-step explanation:

Nathan has a collection of 4,324 toy cars? Him and his friend Nashon divide the cars into rows on Nathan’s
driveway, and they end up with 46 rows. Each row has the same number of cars in it. How many cars are in each
row?

Answers

4324 / 46 = 94
94 cars

Solve for x please. I need step-by-step explanation. Thank you. ​

Answers

Step-by-step explanation:

[tex](7x)^x=7^{7^7}[/tex]

log both sides:

[tex]log_7(7x)^x=log_7(7^{7^7})[/tex][tex]xlog_7(7x)=7^7[/tex][tex]x(1 +log_7x) = 7*7^6[/tex][tex]x(1 +log_7x) = 7^6(1+6)[/tex][tex]x(1 +log_7x) = 7^6(1+log_77^6)[/tex]

Compare both sides to get:

[tex]x=7^6[/tex]

or

[tex]x=117649[/tex]

2x=x-4
solve for x
step by step please

Answers

2x = x - 4

2x - x = - 4

x = - 4

________

Hope it helps ⚜

Answer:

x=-4

Step-by-step explanation:

2x=x-4

2x-x=-4

x=-4

Proof

2*(-4)=-4-4

-8=-8

Equation -5+2 = -3 5+(-2) = 3 2+(-5)=-3 -3+5=2​

Answers

Answer:

false

Step-by-step explanation

:

What is 5796÷25 show working ​

Answers

Answer:

231.84

Step-by-step explanation:

I don't know but use a calculator

write the ratio in simplest form.
12 DVDS to 10 books.

Answers

Answer:

6:5

Step-by-step explanation:

divide both numbers by using gcd/ greatest common divisor

= 12:10/ 2

=6:5

please mark me as brainliest!!! Good luck with your tests!

A color printer prints 10 pages in 3 minutes.
How many minutes does it take per page?

Answers

1.6 is the answer …….

Answer:

3.3 secs

Step-by-step explanation:

divide the pages by the minutes

Find the perimeter. Simplify your answer.

Answers

Answer:

P = 2w - 10

Step-by-step explanation:

To solve this problem use the perimeter formula [tex]P=2l+2w[/tex]

So here we have 1 as the width and w-6 as the length [tex]P=2(w-6) + 2(1)[/tex]

So we multiply 2(w) 2(-6) to get 2w-12

So because 2 times 1 is 2 the perimeter would be [tex]P=2w-12 + 2[/tex]

Simplified would be [tex]P=2w-10[/tex]

because -12 + 2 = 10

Hopes this helps


PLEASE HELP

1/3(9×+16+2)+2x

×-3+7(×+3)-3×-12





USE TWO DIFFERENT METHODS TO EXPAND 1/4(×+2×+16-8)​

Answers

Answer:

Multiply 1/3 with the numbers in the parenthesis and evaluate

Step-by-step explanation:


Erin finds 5% sales tax for a shirt that costs $21. She calculates the tax as
0.05 * 21 = 1.05 or $1.05.
Erin notices that she can add 21 + 1.05 = 22.05 to find the total cost, $22.05.
She uses the Distributive Property to write (1 * 21) + (0.05 * 21) = 1.05 * 21.
For each item, write the total cost of
the item as the product of two
numbers.
Tax
1.05 x 21
a.
b.
c.
d.
Item Name Price Tax Rate
shirt
$21.00 5%
bicycle $45.90 7%
shoes
$67.50 6%
laptop $299.99 8%
$39.95 4%
Credit Debit Subtotal
Check Cash
Tax
Order total
Print Receipt Cash
video game
$474.34

Answers

Answer:  

Step-by-step explanation:

a.  Bicycle  (1.07 x 45.90)

b.  Shoes  (1.06 x 67.50)

c.  Laptop  (1.08 x 299.99)

d.  Video Game (1.04 x 39.95)

100 IF U GET THIS RIGHT!

Answers

Answer:

y-intercept: 3/7

Step-by-step explanation:

Our equation: y = mx + b

Given equation: y = 6x + 3/7

Now, let's compare:

y = mx + b = y = 6x + 3/7

We can tell that the y intercept is b, which is 3/7

Hoped this helped.

Answer:

y-intercept: 3/7

Step-by-step explanation:

Check the number or numbers that are in the solution set of the equation

below.

7x > 42

A. 14

B. 5

C.35

D. 6

E. 12

F9



Answers

Answer:

A, C, E, F

Step-by-step explanation:

when you multiply the numbers with 7 the answer is greater than 42

4) A company manufactures widgets. The expense function E=8q+12,000 and the
demand function q= -10p +20,000, where p is the price.

a. Express the variable expense V in terms of q, where q is the quantity of widgets
produced

b. Express the total expenso E in terms of p.

c. Determine the Revenue R in terms of p. (Hint: R=p•q).

d. Determine the profit P in terms of p. (Hint: P=R-E).

e. Determine the price that will yield the maximum profit. (Hint: x = -b/2a).

f. Determine the maximum profit.

Answers

Revenue, profit and expenses are all integral parts of a company's balance sheet

The expense in terms of q is [tex]\mathbf{E = 8q + 12000}[/tex]The expense in terms of p is [tex]\mathbf{E = -80p + 172000}[/tex]The revenue in terms of p is [tex]\mathbf{R = -10p^2 + 20000p}[/tex]The profit in terms of p [tex]\mathbf{P =-10p^2 + 20080p - 172000}[/tex]The price that yields the maximum profit is $1004The maximum profit is $9908160

The expense function is given as:

[tex]\mathbf{E = 8q + 12000}[/tex]

The demand function is given as:

[tex]\mathbf{p = -10p + 20000}[/tex]

(a) The expense in terms of q

This is already given as: [tex]\mathbf{E = 8q + 12000}[/tex]

(b) The expense in terms of p

Substitute -10p + 20000 for p in [tex]\mathbf{E = 8q + 12000}[/tex]

[tex]\mathbf{E = 8(-10p + 20000) + 12000}[/tex]

Expand

[tex]\mathbf{E = -80p + 160000 + 12000}[/tex]

[tex]\mathbf{E = -80p + 172000}[/tex]

(c) The revenue in terms of P

This is calculated as:

[tex]\mathbf{R = p \times q}[/tex]

So, we have:

[tex]\mathbf{R = p \times (-10p + 20000)}[/tex]

Expand

[tex]\mathbf{R = -10p^2 + 20000p}[/tex]

(d) The profit in terms of p

We have:

[tex]\mathbf{R = -10p^2 + 20000p}[/tex] and [tex]\mathbf{E = -80p + 172000}[/tex]

So, the profit P is calculated as:

[tex]\mathbf{P =R - E}[/tex]

This gives

[tex]\mathbf{P =-10p^2 + 20000p +80p - 172000}[/tex]

[tex]\mathbf{P =-10p^2 + 20080p - 172000}[/tex]

(e) The price that yields maximum profit

In (d), we have:

[tex]\mathbf{P =-10p^2 + 20080p - 172000}[/tex]

The maximum price is calculated using:

[tex]\mathbf{p = -\frac{b}{2a}}[/tex]

Where:

[tex]\mathbf{b =20080}[/tex]

[tex]\mathbf{a = -10}[/tex]

So, the equation becomes

[tex]\mathbf{p = -\frac{20080}{2 \times -10}}[/tex]

[tex]\mathbf{p = 1004}[/tex]

Hence, the price that yields the maximum profit is $1004

(f) The maximum profit

In (e), we have: [tex]\mathbf{p = 1004}[/tex]

Substitute 1004 for p in [tex]\mathbf{P =-10p^2 + 20080p - 172000}[/tex]

[tex]\mathbf{P =-10(1004)^2 + 20080(1004) - 172000}[/tex]

[tex]\mathbf{P =9908160}[/tex]

Hence, the maximum profit is $9908160

Read more about revenue, expenses and profit at:

https://brainly.com/question/23103804

Which function represents a reflection of f(x)=3/8
(4) across the y-axis?
O g(x) = - a)
O g(x) = - 3 (4%
o g(x) = (4)
O g(x) = 2 (4)*

Answers

Answer:

Step-by-step explanation:

Reflecting a function across the Y axis means replacing x with -x.

First one could *almost* work, if there wasn't the minus sign at the beginning, so it's a no.

Second one is also a no, the original one is always positive, the second one is always negative.

3rd one is reflecting the graph all right, but it's also adding some sort of stretch (try with the point x=1 in both cases, [tex]f(1) = \frac 32[/tex] while [tex]g_3(1) = 2/3[/tex]

4th one is the charm.

The function that represents a reflection of f(x) = (3/8) 4^x across the y-axis is [tex]g(x) = (3/8) 4^{-x}.[/tex]

Option D is the correct answer.

What is a function?

A function has an input and an output.

A function can be one-to-one or onto one.

It simply indicated the relationships between the input and the output.

Example:

f(x) = 2x + 1

f(1) = 2 + 1 = 3

f(2) = 2 x 2 + 1 = 4 + 1 = 5

The outputs of the functions are 3 and 5

The inputs of the function are 1 and 2.

We have,

To reflect the function f(x) = (3/8) 4^x across the y-axis, we need to replace x with -x in the function.

This will cause the function to be reflected across the y-axis.

So,

The function that represents the reflection of f(x) = (3/8) 4^x across the y-axis is:

g(x) = (3/8) 4^(-x)

We replaced x with -x in f(x) and simplified to obtain g(x).

Therefore,

The function that represents a reflection of f(x) = (3/8) 4^x across the y-axis is [tex]g(x) = (3/8) 4^{-x}.[/tex]

Learn more about functions here:

https://brainly.com/question/28533782

#SPJ7

Please help! take a pic and put a dot with the drawing tools on ur snipping tool/snip and sketch. Please i cant fail these questions!

Answers

Answer:

x > 7/8 and the picture is below.

Step-by-step explanation:

To find the answer, you plug in the values for x. Nothing less than one in the set of given values, works. 1 works, 9/4 works, and 5/2 works. But everything else doesn't. Or, you could simply divide both sides by 2 to get x alone. That makes x>7/8. Meaning 7/8 doesn't work, but anything above it, does. So you could just look for the ones that are greater than 7/8.

For A brainly please help me out

Answers

Answer: 2, 2

Brainly?

GIVING BRAINLIEST!! (ignore the answer i put i accidentally clicked on it) A line passes through the point (-2, 7) and has.a slope of -5.
What is the value of a if the point (a, 2) is also on the line?

Answers

the answer is -1 just believe me

7.6.1 Determine the new dimensions of the follo figures below given the scale factor: 1 Scale Factor of 1/4 4 U! 6 15 in 12 in​

Answers

Answer: at least 2

Step-by-step explanation: idek

Other Questions
Qu'est-ce qu'on va prparer? Parlons/crivons Regarde bien l'illustration. Est-ce que tu peux prparer les plats suivants avec les ingrdients qu'il y a sur l'illustration? Pourquoi ou pourquoi pas? MODELE des ptes au fromage Non; II y a du fromage, mais il n'y a pas de ptes. 1. une omelette au fromage et aux champignons 2. un croque-monsieur 3. une salade avec des tomates 4. un gteau au chocolat 5. une quiche au fromage 1 . Est-ce que tu peux prparer une omelette au fromage et aux champignons ? 2. Est-ce que tu peux prparer un croque-monsieur ? 3. Est-ce que tu peux prparer une salade avec des tomates ? 4. Est-ce que tu peux prparer un gateau au chocolat ? 5. Est-ce que tu peux prparer une quiche au fromage ? how do you tell between a linear and non-linear function? orFind the slope of the line y = 95x 95. How did the rise of privately owned cable TV networks affect the revenue structure of European soccer teams? what do you believe was Hamiltons reasoning for assuming states debts? PLEASE FAST!! WILL GIVE BRAINLIEST 30 POINTS!! Imagine you are sitting next to a person who has a very strong body odor on a crowded bus. All you can think about is getting off the bus, so you will not have to smell the person any longer. You know that body odor can mean someone has health problems, so you begin to fear for your own health. You have learned that if a person has significantly poor hygiene, it can cause harm for those around them.Answer the following questions:What are the differences between communicable and noncommunicable diseases?What types of diseases can result from poor hygiene?Is poor hygiene a symptom of a communicable disease? If so, which one? How many sulfur atoms are there in 25 molecules c4h4s2?. 1) Over their lifetime, a high school dropout will make how much less money than a college graduate? A) $5,000 B) $10,000 C) $100,000 D) $1 million sports photographers often use large aperture, long focal length lenses. what limitations do these lenses impose on the photographs? Her little brother is walking to school. She id...* Triangle IJK has the coordinates listed:Where is J' after a reflection over the y-axis? 100 PTSSSSSGive your insight about the question below. Write on the given space provided. (not less than 5sentences) "how related are the characteristics of plants and humans interms of survival?" i need help with this word problem please! :) PLS HELP WILL MARK YOU BRAINLIEST!!! Robert Hooke was the first person to observe cells. He observed these cells in(a) a piece of cork.(b) a slice of honeycomb.(c) human blood.(d) plaque from his own teeth. what is a ratio comparing two different units. An ethical and competent persuasive speech should contain all three of the a. types of propositions. b. motivational appeals. c. rhetorical proofs. d. types of reasoning. solve pls brainliest if something traveled 36 feet in 22 frames in a 60 fps video, how fast would that be in mph? what do muesums provide that smaller galleries and private collections may not offer? no links please thank you