Binary Conversion

Brian's Notes from late July 2016:

In Unit 4 you learned about the binary representation of a number. In this project, you'll write a reporter decimal->binary that takes a number (which Snap! represents in decimal) as input, and reports a string of zeros and ones that represent the same number in binary:
decimal->binary of 9827

To solve this problem, you'll need to work with integer division into a quotient and remainder. For example, 17 รท 5 is 3 with a remainder of 2. Here's how to find the quotient and remainder in Snap! :

To find floor you'll need the sqrt block, then change the operation. The floor of a number is the largest integer less than or equal to that number. The floor of π is 3.
quotient mod

From AC: ask students to build the integer division block. BK: did not choose to do this because "floor" is very hard to locate. There are multiple methods to calculate the integer division, but the "floor" method is the most clear constant time method.
  1. Write the decimal->binary block. If you're stuck after trying as many ideas as you can think of, go to this page for some help.