subject
Mathematics, 29.02.2020 04:53 lamafiablanca1ovtpyl

Convert to binary - functionsWrite a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is:As long as x is greater than 0 Output x % 2 (remainder is either 0 or 1) x = x / 2Note: The above algorithm outputs the 0's and 1's in reverse order. You will need to write a second function to reverse the string. Ex: If the input is:6the output is 110.

ansver
Answers: 1

Another question on Mathematics

question
Mathematics, 21.06.2019 13:10
How do you answer this question? (step by step)
Answers: 3
question
Mathematics, 21.06.2019 16:00
What is the sum of these mixed numbers 2 1/8 + 4 3/8
Answers: 1
question
Mathematics, 21.06.2019 19:20
1- is the product of two rational numbers irrational or rational? first, make a hypothesis by multiplying two rational numbers. then, use variables such as x=a/b and y=c/d and the closure property of integers to prove your hypothesis. 2- what do you think the product of a nonzero rational number and an irrational number is? is it rational or irrational? make use of variables, the closure property of integers, and possibly a proof by contradiction to prove your hypothesis. 3- why do we have to specify that the rational number must be nonzero when we determine what the product of a nonzero rational number and an irrational number is? if the rational number were 0, would it give us the same result we found in part b?
Answers: 3
question
Mathematics, 21.06.2019 19:30
Suppose i pick a jelly bean at random from a box containing one red and eleven blue ones. i record the color and put the jelly bean back in the box. if i do this three times, what is the probability of getting a blue jelly bean each time? (round your answer to three decimal places.)
Answers: 1
You know the right answer?
Convert to binary - functionsWrite a program that takes in a positive integer as input, and outputs...
Questions
question
Mathematics, 03.06.2021 18:20
question
Mathematics, 03.06.2021 18:20
question
Mathematics, 03.06.2021 18:20
Questions on the website: 13722363