title: Program Octal Decimal Conversion
signature: func programOctalDecimalConversion(n int) int {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int, expected int) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(n int, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(n),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(37, 31)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(25, 21)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(63, 51)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(66, 54)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(32, 26)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(5, 5)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(41, 33)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(82, 66)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(54, 44)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(5, 5)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
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;
  }