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, 21.06.2019 18:10
In mathematics and computer science, a set is a collection in which order does not matter and there are no duplicates. in this problem, we are going to to define a class which wil allow us to create an object to represent a set of integers. you will write a program set.java to define the class set. each instance of the class set will be an object representing a set of integers.
Answers: 3
Computers and Technology, 22.06.2019 08:00
What is the algorithm for building a binary tree program
Answers: 2
Computers and Technology, 22.06.2019 22:20
Avariable of the data type arrays is storing 10 quantities. what is true about these quantities? a. the quantities all have different characteristics. b. the quantities all have the same characteristics. c. five quantities have the same and five have different characteristics. d. it is necessary for all quantities to be integers. e. it is necessary for all quantities to be characters.
Answers: 2
Computers and Technology, 23.06.2019 05:30
Sally is editing her science report about living things. she needs to copy a paragraph from her original report. order the steps sally needs to do to copy the text to her new document.
Answers: 1
Create a program that ask the user to enter the number of switches and calculates the
possible outc...
Social Studies, 15.12.2020 16:40
English, 15.12.2020 16:40
Mathematics, 15.12.2020 16:40
Mathematics, 15.12.2020 16:40
English, 15.12.2020 16:40
Mathematics, 15.12.2020 16:40
Mathematics, 15.12.2020 16:40
English, 15.12.2020 16:40
Social Studies, 15.12.2020 16:40
Mathematics, 15.12.2020 16:40