title: Decimal Binary Conversion Without Using Arithmetic Operators
signature: function decimal_binary_conversion_without_using_arithmetic_operators(n)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return actual == expected
  end
  
  function driver(n, expected)
      try
  
          if validate_solution(PLACEHOLDER_FN_NAME(n), expected)
              return "PASSED";
          end
          return "FAILED";
      catch exception_obj
          return string(Base.typename(typeof(exception_obj)).wrapper);
      end
  end
  
  function main()
      
      result = driver(35, "100011");
      @printf("TEST-0...%s\n",result);
      
      result = driver(17, "10001");
      @printf("TEST-1...%s\n",result);
      
      result = driver(8, "1000");
      @printf("TEST-2...%s\n",result);
      
      result = driver(99, "1100011");
      @printf("TEST-3...%s\n",result);
      
      result = driver(57, "111001");
      @printf("TEST-4...%s\n",result);
      
      result = driver(39, "100111");
      @printf("TEST-5...%s\n",result);
      
      result = driver(99, "1100011");
      @printf("TEST-6...%s\n",result);
      
      result = driver(14, "1110");
      @printf("TEST-7...%s\n",result);
      
      result = driver(22, "10110");
      @printf("TEST-8...%s\n",result);
      
      result = driver(7, "111");
      @printf("TEST-9...%s\n",result);
      
  end
  
  main()
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;
  }