Computers and Technology, 24.10.2020 14:00 door9817
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
Answers: 2
Computers and Technology, 22.06.2019 23:30
What does 21 pilots middle aged name as a band 15 years prior to them naming their band 21 pilots?
Answers: 1
Computers and Technology, 23.06.2019 09:20
How to print: number is equal to: 1 and it is odd number number is equal to: 2 and it is even number number is equal to: 3 and it is odd number number is equal to: 4 and it is even number in the console using java using 1 if statement, 1 while loop, 1 else loop also using % to check odds and evens
Answers: 3
Computers and Technology, 23.06.2019 16:00
What is the biggest difference between section breaks and regular page breaks? section breaks are more difficult to add than page breaks. section breaks make it easier for you to view the document as an outline. section breaks allow you to have areas of the document with different formatting. section breaks are smaller than regular page breaks.
Answers: 2
Computers and Technology, 23.06.2019 19:30
Amitha writes up a one-page summary of a novel during her summer internship at a publishing company. when she reads over the page, she realizes she used the word “foreshadow” seven times, and she would like to reduce the repetition. which tool would best amitha solve this problem?
Answers: 3
Create a program that ask the user to enter the number of switches and calculates the
possible outc...
Business, 22.06.2021 18:30
Social Studies, 22.06.2021 18:30
Mathematics, 22.06.2021 18:30
English, 22.06.2021 18:30
Mathematics, 22.06.2021 18:30
English, 22.06.2021 18:30
Computers and Technology, 22.06.2021 18:30