I can not create a code to convert numbers from decimal to binary, can anyone give me a hand or a suggestion?

When I Google *convert decimal to binary algorithm*, I get this:

Step 1: Divide the number by 2 and find the remainder, then store the remainder in an array.

Step 2: Divide the number by 2.

Step 3: Repeat the above two steps until the number is greater than zero.

Step 4: Print the array in reverse order to get the binary representation of the number.

Have you tried that?

thank you

it doesn’t work, tell me if I did something wrong in writing the code. even if it doesn’t seem like it

I tried both codes but it always gives me 0, for example I insert 10 which should give me 101 and it gives me 0

Why are you adding BINARIO to the remainder? That’s not part of the algorithm. It says to add the remainder to an **array**, not an integer as you’re doing. That means you have to start with an empty list and then add an item to the list each time you get a remainder. And then convert the completed list to a text string. Or you could join the remainder to an empty text string to start with. Either way should work.

try getting the binary value of 0 (zero)

thanks