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, 23.06.2019 06:30
Which option correctly describes a dbms application? a. software used to manage databases b. software used to organize files and folders c. software used to develop specialized images d. software used to create effective presentations
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
You have a small company and want to keep your costs low, but it is important your employees share data. which network would provide you with the most economical solution?
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
Describe three characteristics of at-risk drivers. a. b. c. describe three characteristics of safe drivers. a. b. c. describe three driver errors that could cause a collision. a. b. c. how will this information affect you as a driver now and in the future? (2-3 sentences)
Answers: 2
question
Computers and Technology, 23.06.2019 12:00
What type of slide show is a dynamic and eye-catching way to familiarize potential customers with what your company has to offer? a. ole b. photo album c. brochure d. office clipboard
Answers: 2
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
Advanced Placement (AP), 20.10.2020 20:01
question
Mathematics, 20.10.2020 20:01
question
Law, 20.10.2020 20:01
question
Chemistry, 20.10.2020 20:01
question
Biology, 20.10.2020 20:01
Questions on the website: 13722363