title: Program Octal Decimal Conversion
signature: function programOctalDecimalConversion(n: number): number {
source_py: def program_octal_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 * 8)
      return dec_value
source_cpp: int program_octal_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 * 8;
    }
    return dec_value;
  }
question_info.test_list: [{"idx": 0, "outputs": 31, "inputs": {"n": 37}}, {"idx": 1, "outputs": 21, "inputs": {"n": 25}}, {"idx": 2, "outputs": 51, "inputs": {"n": 63}}, {"idx": 3, "outputs": 54, "inputs": {"n": 66}}, {"idx": 4, "outputs": 26, "inputs": {"n": 32}}, {"idx": 5, "outputs": 5, "inputs": {"n": 5}}, {"idx": 6, "outputs": 33, "inputs": {"n": 41}}, {"idx": 7, "outputs": 66, "inputs": {"n": 82}}, {"idx": 8, "outputs": 44, "inputs": {"n": 54}}, {"idx": 9, "outputs": 5, "inputs": {"n": 5}}]
question_info.entry_cls_name: Solution
question_info.test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: number, expected: number): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(n: number, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(37, 31);
    console.log(`TEST-0...${result}`);
  
    result = driver(25, 21);
    console.log(`TEST-1...${result}`);
  
    result = driver(63, 51);
    console.log(`TEST-2...${result}`);
  
    result = driver(66, 54);
    console.log(`TEST-3...${result}`);
  
    result = driver(32, 26);
    console.log(`TEST-4...${result}`);
  
    result = driver(5, 5);
    console.log(`TEST-5...${result}`);
  
    result = driver(41, 33);
    console.log(`TEST-6...${result}`);
  
    result = driver(82, 66);
    console.log(`TEST-7...${result}`);
  
    result = driver(54, 44);
    console.log(`TEST-8...${result}`);
  
    result = driver(5, 5);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: programOctalDecimalConversion
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: tsc --target es2020 --lib es5,dom,es2015,es2020 __FILENAME__
question_info.commands: node __FILENAME__.js