title: Program Binary Decimal Conversion
signature: function program_binary_decimal_conversion(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(70, 14);
      @printf("TEST-0...%s\n",result);
      
      result = driver(95, 23);
      @printf("TEST-1...%s\n",result);
      
      result = driver(41, 9);
      @printf("TEST-2...%s\n",result);
      
      result = driver(97, 25);
      @printf("TEST-3...%s\n",result);
      
      result = driver(8, 8);
      @printf("TEST-4...%s\n",result);
      
      result = driver(16, 8);
      @printf("TEST-5...%s\n",result);
      
      result = driver(41, 9);
      @printf("TEST-6...%s\n",result);
      
      result = driver(57, 17);
      @printf("TEST-7...%s\n",result);
      
      result = driver(81, 17);
      @printf("TEST-8...%s\n",result);
      
      result = driver(78, 22);
      @printf("TEST-9...%s\n",result);
      
  end
  
  main()
source_py: def program_binary_decimal_conversion(n):
      num = n
      dec_value = 0
      base = 1
      temp = num
      while temp:
          last_digit = (temp % 10)
          temp = int((temp / 10))
          dec_value += (last_digit * base)
          base = (base * 2)
      return dec_value
source_cpp: int program_binary_decimal_conversion(int n) {
    int num = n;
    int dec_value = 0;
    int base = 1;
    int temp = num;
    while ( temp ) {
      int last_digit = temp % 10;
      temp = temp / 10;
      dec_value += last_digit * base;
      base = base * 2;
    }
    return dec_value;
  }