title: Decimal Binary Conversion Without Using Arithmetic Operators
signature: decimal_binary_conversion_without_using_arithmetic_operators <- function(n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          35L, 
          "100011"
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          17L, 
          "10001"
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          8L, 
          "1000"
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          99L, 
          "1100011"
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          57L, 
          "111001"
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          39L, 
          "100111"
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          99L, 
          "1100011"
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          14L, 
          "1110"
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          22L, 
          "10110"
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          7L, 
          "111"
      )))
  
  }
  
  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;
  }