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
Scilla [17]
3 years ago
12

Consider the following switch statement where x is an int. If x is currently equal to 5, what will the value of x be after the s

witch statement executes? switch (x) { case 3 : x += 1; case 4 : x += 2; case 5 : x += 3; case 6 : x++; case 7 : x += 2; case 8 : x--; case 9 : x++
Mathematics
1 answer:
Sphinxa [80]3 years ago
3 0

Answer:

x=11

Step-by-step explanation:

The switch case works like an if or if-else, where each of the cases are conditionals. Here we have 7 cases and we know that our variable begins with x=5.

First, it enters to case 5 because of x=5, so x+=3, this means we add 3 to the actual value of the variable ⇒ x=8.  

At this point, if there's not break the program continues to the next case, executing the statements until a break or the end on the switch is reached.  

In this order, the x = 8 and next we add 1 (case 6) ⇒ x=9. We add 2 (case 7) x+=2 ⇒ x=10. Then we rest 1 (case 8) ⇒ x=9 and then we add 1 again as in case 9 ⇒ x=11.

You might be interested in
SOMEONE HELPFUL PLZ ANSWER!!!!!!!! WILL MARK BRAINLIEST!!!!!!!!!
Eva8 [605]

Answer:5,6 or 15,2

5x6x1.5 =45

15x2x1.5=45

3 0
2 years ago
The mean radius of earth is 6,371.0 kilometers and the mean radius of Earth's Moon is 1,737.5 kilometers.What is the approximate
Dmitrij [34]
D≈2π(6371-1737.5)

d≈9267π

d≈29113.1km (to nearest tenth of a kilometer)
4 0
3 years ago
A caterer prepared a turkey that weighed 22 1/2 pounds.Each serving of the turkey will be 1/3 pound.How many whole servings will
AlladinOne [14]
1/2 1/2 1/2 1/3
1 \times 2 = 3
8 0
2 years ago
Read 2 more answers
What is 2 5/12 - 1 7/12 =
castortr0y [4]

Answer:

Divide: 7/12  : 3/10  = 7/12  · 10/3= 7 · 10  /12 · 3  = 70/36  = 35/18

To divide one fraction by another, invert (turn upside-down) the second fraction, then multiply.

Hope this helps:)sorry if it doesnt

4 0
3 years ago
How much money should John get back when he uses $10 to pay for purchases totaling $5.25
Archy [21]
$4.75 would be the answer
3 0
3 years ago
Read 2 more answers
Other questions:
  • N-8=-4+5n solve for n.
    15·1 answer
  • 8x^3-22x^2-4 divided by 4x-3
    9·1 answer
  • Rodrigo traveled at an average speed of 55 miles per hour for 5 hours to get from one national park to the next on his vacation.
    8·1 answer
  • Find the distance between a(-3,1) and b(-5,5)
    10·2 answers
  • Mr. Case is placing boxes along one of the walls in his attic. If the wall is 11 1⁄3 feet long and each box is 2 1⁄2 feet long,
    15·1 answer
  • Triangle Abc is similar to triangle xyz.calculate the length of side yz
    6·1 answer
  • What is the equation of a circle with endpoints of the diameter at (-8, -5) and (-4, 1) ??
    5·1 answer
  • Which of the following is a Pythagorean triple?
    5·2 answers
  • What are verbs? Example ​
    14·2 answers
  • A pack of cookies contains 24 cookies. Now the advertisement says that the pack contains 25% more then before How many cookies a
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!