subject

Create a program that ask the user to enter the number of switches and calculates the possible outcomes that can come from those many number of switches (on / off).

Follow the steps given below to achieve the desired result:

● Step 1: Get the number of switches from the user and store it in a variable (lets

say switches).

● Step 2: Initialize 3 variables max_poss = 2, i = 1 and power = 1, where,

○ max_poss = 2 denotes the maximum possibile outcome of 1 switch (i. e. on

and off),

○ i is used to set the condition in while loop and it will keep incrementing

unless all the switches are over.

○ power variable is further used to store the result.

● Step 3: Define a while loop with a condition to execute till the value of i is less

than or equal to switches.

● Step 4: Inside the while loop,

○ Multiply the value stored in max_poss with power and store the result in

power.

○ Increment the value of i by 1.

For eg: When switches = 2, In the

1st iteration, power = 2 and in the 2nd iteration, power = 2 * 2 i. e. 4. This indicates that, the

number of possible outcomes = 2switches, where switches denotes the number of

switches.

● Step 5: Print the total number of possible outcomes stored in variable power.
plss help me with this

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 05:00
This program will store roster and rating information for a soccer team. coaches rate players during tryouts to ensure a balanced team. (1) prompt the user to input five pairs of numbers: a player's jersey number (0 - 99) and the player's rating (1 - 9). store the jersey numbers in one int vector and the ratings in another int vector. output these vectors (i.e., output the roster). (3 pts) ex: enter player 1's jersey number: 84 enter player 1's rating: 7 enter player 2's jersey number: 23 enter player 2's rating: 4 enter player 3's jersey number: 4 enter player 3's rating: 5 enter player 4's jersey number: 30 enter player 4's rating: 2
Answers: 1
question
Computers and Technology, 22.06.2019 21:30
The graph shows median weekly earnings for full-time workers according to education level. which can you not conclude?
Answers: 2
question
Computers and Technology, 23.06.2019 07:30
Which option allows you to view slides on the full computer screen?
Answers: 1
question
Computers and Technology, 24.06.2019 00:00
Afashion designer wants to increase awareness about her brand. which network can she use and why she can use the blank to blank her products online. answers for the first blank: internet, extranet, or intranet answers for the second blank: market, design, and export
Answers: 1
You know the right answer?
Create a program that ask the user to enter the number of switches and calculates the possible outc...
Questions
question
Mathematics, 09.07.2019 23:00
question
Mathematics, 09.07.2019 23:00
Questions on the website: 13722361