title: Program Binary Decimal Conversion
signature: programBinaryDecimalConversion(n) {
test_code: import 'dart:convert';
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(int actual, int expected){
      return actual.toString() == expected.toString();
  }
  
  String driver(n, int expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(n), expected)){
              return "PASSED";
          }
          return "FAILED";
      }catch(exception_object){
          return exception_object.runtimeType.toString();
      }
  }
  
  int main() {
  
      print("TEST-0...${driver(
          70, 
          14)
      }");
  
      print("TEST-1...${driver(
          95, 
          23)
      }");
  
      print("TEST-2...${driver(
          41, 
          9)
      }");
  
      print("TEST-3...${driver(
          97, 
          25)
      }");
  
      print("TEST-4...${driver(
          8, 
          8)
      }");
  
      print("TEST-5...${driver(
          16, 
          8)
      }");
  
      print("TEST-6...${driver(
          41, 
          9)
      }");
  
      print("TEST-7...${driver(
          57, 
          17)
      }");
  
      print("TEST-8...${driver(
          81, 
          17)
      }");
  
      print("TEST-9...${driver(
          78, 
          22)
      }");
  
      return 0;
  }
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;
  }