Find the number obtained after concatenation of binary representation of M and N | C # implementation of the approach ; Utility function to calculate binary length of a number . ; Function to concatenate the binary numbers and return the decimal result ; Find binary length of n ; left binary shift m and then add n ; Driver code
using System ; class GFG { static int getBinaryLength ( int n ) { int length = 0 ; while ( n > 0 ) { length += 1 ; n /= 2 ; } return length ; } static int concat ( int m , int n ) { int length = getBinaryLength ( n ) ; return ( m << length ) + n ; } static void Main ( ) { int m = 4 , n = 5 ; Console . WriteLine ( concat ( m , n ) ) ; } }