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 Binary Strings of length N using Branch and Bound
- 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
- Convert a binary number to hexadecimal number
- Binary representation of next greater number with same number of 1's and 0's
- Maximum number of splits of a binary number
- 1's and 2's complement of a Binary Number
- Binary representation of next number
- Convert a binary number to octal
- Decimal to binary number using recursion
- Binary representation of previous number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.