Given a positive integer number n generate all the binary number from 0 to n.
Input : 5 Output : 0 1 10 11 100 101 Binary numbers are 0(0), 1(1), 2(10), 3(11), 4(100) and 5(101). Input : 10 Output : 0 1 10 11 100 101 110 111 1000 1001 1010
This program simple use predefined function (itoa() in C++) which convert in which base you want. so simple used these function and convert binary number it is consist three value.
0 1 10 11 100 101 110 111 1000 1001 1010
- Generate all binary strings without consecutive 1's
- Generate all binary strings from given pattern
- Generate all binary strings of length n with sub-string "01" appearing exactly twice
- Generate number with given operation and check if it is palindrome
- Number of ways to split a binary number such that every part is divisible by 2
- Program to Convert Octal Number to Binary Number
- Binary representation of next greater number with same number of 1's and 0's
- Convert a binary number to hexadecimal number
- Maximum number of splits of a binary number
- Binary representation of next number
- 1's and 2's complement of a Binary Number
- Decimal to binary number using recursion
- Binary representation of previous number
- Convert a binary number to octal
- Find the maximum possible Binary Number from given string
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.