Convert Decimal Number to Binary Number
Given a decimal number, continue dividing the number by 2 until it reaches either 0/1 and record the remainder at each step. The resulting list of remainders is the equivalent binary number for your decimal number.
Repeatedly do the modulo operation until
%” and “
So, using the modulo and division method, we calculate the binary representation of a decimal number. Let’s represent the binary by considering the remainder column from bottom to top.
The illustration below explains the process of counting the digits in an integer.