Given two integers M and N the task is to find the number formed by concatenating the binary equivalents of M and N i.e. M + N.
Input: M = 4, N = 5
Binary equivalent of 4 is 100 and for 5 it is 101
after concatenation, the resultant binary number
formed is 100101 whose decimal equivalent is 37.
Input: M = 3, N = 4
Approach: Convert both the numbers M and N into there binary equivalents then concatenate these numbers as M + N and print the decimal equivalent of the resulting binary number formed after concatenation.
Below is the implementation of the above approach:
- Find the n-th number whose binary representation is a palindrome
- Find consecutive 1s of length >= n in binary representation of a number
- Find the occurrence of the given binary pattern in the binary representation of the array elements
- Find i’th index character in a binary string obtained after n iterations | Set 2
- Find i'th Index character in a binary string obtained after n iterations
- Find value of k-th bit in binary representation
- Binary representation of next number
- Binary representation of a given number
- Count number of trailing zeros in Binary representation of a number using Bitset
- Check if the binary representation of a number has equal number of 0s and 1s in blocks
- Largest number with binary representation is m 1's and m-1 0's
- Binary representation of previous number
- Next greater number than N with exactly one bit different in binary representation of N
- Find next greater element with no consecutive 1 in it's binary representation
- Find longest sequence of 1's in binary representation with one flip
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.