can you explain how to solve it in details 2. Converting decimal (base 10) numbe
ID: 3549073 • Letter: C
Question
can you explain how to solve it in details
2. Converting decimal (base 10) numbers to binary (base 2):
Q2A: Execute the algorithm below using 6 for "number".
Q2B: Execute the algorithm below using 25 for "number".
Q2C: Draw a flowchart for the algorithm below and have it checked by the TA (it will not be
submitted).
Notes: "top number" is the rightmost number on the top line; "middle number" is the rightmost
number on the middle line.
*Algorithm:
Type: "top:" "middle:", "answer:" each word on its own line.
Type number on the top line, and "1" on the middle line.
while (twice middle number is less than top number) do
type twice middle number one space to the right of middle number (for example, "1 2")
endwhile
while (middle number is greater than or equal to 1) do
if (top number is greater than or equal to middle number) then
type "1" on the answer line (to the right of any existing digits, with no spaces)
type top number minus middle number one space to the right of top number
else
type "0" on the answer line (to the right of any existing digits, with no spaces)
endif
type middle number divided by 2 one space to the right of middle number
endwhile
"answer:" is the binary representation of number
Explanation / Answer
6 => 110
25 => 11001
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.