Why not display the result on the screen? I tried to convert decimal to binary number in Scratch, but it is not working. Can anyone see what the error is?
entradaUsuario
variable at each iteration.
At each iteration of looping , the algorithm extracts the binary digit through a remainder division operation by 2 and stores that digit in the list.
Then divide entradaUsuario
by 2 until it reaches zero.
Follow the algorithm below:
LinktotheprojectontheScratchsite: Decimal for Binary
If you really need to get the digits into separate variables, simply run the algorithm without looping by repeating the code for the number of binary digits you need: