Рет қаралды 13,762
This program demonstrates the logic and code for converting decimal number to binary number
Normal integer number are by default decimal number ( base 10 , which contains digits from 0 to 9), example: 100,34534,-345345.
Every decimal number internally stored as binary number ( base 2, which contains only two digits,i.e. 0 and 1 ).
Converting decimal to binary involves the following steps
1. we need to divide the decimal number by 2 til it reaches to 0
2. In this process we need to store the remainders
3. The remainders must be printed in the reverse order to get the binary representation.
Example : 10 decimal is equivalent to 1010.
In this video session, we have discussed the following approaches to convert decimal to binary
1. Using Integer.toBinaryString(int no) the pre-defined method in Java API
2. Using array to store all the remainders
3. Using String to concatenate all the remainders
If you like this video, don't forget to subscribe , like and share this video
Please promote this channel , by sharing it with your friends who are searching / preparing for IT jobs in programming..
If you have any coding challenges ( questions ) , post them in the comment, we will upload the videos for the same