Decimal base to binary base conversion
Decimal Number System:
In the decimal number system we use 10 digits from 0 to 9 and decimal system has radix (base) 10. Example: 2343, 2543, 66, 100 etc.
Binary Number System:
In the binary number system we use two digits 0 and 1. Here the combination of 0 and 1 make the all the possible combination. The digit 0 or 1 individually called bit. In the electronic system, we use 0 as low output and 1 as high output.
Logic:
The logic behind the converting of decimal number system to binary number system is that firstly we divide the decimal number by 2 successively and take its remainder and quotient and then again quotient becomes the number and again divided by 2 and this process continues until the quotient becomes zero.
Example: Quotient Remainder
15/2 = 7 1 LSB
7/2 = 3 1
3/2 = 1 1
1/2 = 0 1 MSB
Here LSB=Least Significant Bit
MSB= Most Significant Bit
Algorithm:
Step 1: Start
Step 2: Take decimal number from the keyboard.
Step 3: Divide the decimal number by 2.
Step 4: Write the remainder and quotient.
Step 5: Quotient of previous stage become the dividend and again divides it by 2 at next stage.
Step 6: Write the remainder to R.H.S.
Step 7: Repeat the process successively till quotient is zero.
Step 8: Write the remainder from MSB to LSB we get the binary equivalent of the given decimal number.
Step 9: Stop.