title: Decimal Binary Conversion Without Using Arithmetic Operators
signature: func decimalBinaryConversionWithoutUsingArithmeticOperators(n int) string {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual string, expected string) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(n int, expected string) string {
      if validateSolution(PLACEHOLDER_FN_NAME(n),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(35, "100011")
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(17, "10001")
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(8, "1000")
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(99, "1100011")
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(57, "111001")
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(39, "100111")
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(99, "1100011")
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(14, "1110")
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(22, "10110")
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(7, "111")
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def decimal_binary_conversion_without_using_arithmetic_operators(n):
      if (n == 0):
          return '0'
      bin = ''
      while (n > 0):
          if ((n & 1) == 0):
              bin = ('0' + bin)
          else:
              bin = ('1' + bin)
          n = (n >> 1)
      return bin
source_cpp: string decimal_binary_conversion_without_using_arithmetic_operators(int n) {
    if ( n == 0 ) return "0";
    string bin = "";
    while ( n > 0 ) {
      bin = ( ( n & 1 ) == 0 ? '0' : '1' ) + bin;
      n >>= 1;
    }
    return bin;
  }