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
- 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
- 1's and 2's complement of a Binary Number
- Binary representation of next number
- Decimal to binary number using recursion
- Binary representation of previous number
- Convert a binary number to octal
- Occurrences of a pattern in binary representation of a number
- Convert decimal fraction to binary number
- Number of substrings with odd decimal value in a binary 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 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.