title: Program Check Plus Perfect Number
signature: func programCheckPlusPerfectNumber(x int) bool {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual bool, expected bool) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(x int, expected bool) string {
      if validateSolution(PLACEHOLDER_FN_NAME(x),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(371, true)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(9474, true)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(85, false)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(35, false)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(54, false)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(17, false)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(97, false)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(63, false)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(12, false)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(43, false)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def program_check_plus_perfect_number(x):
      temp = x
      n = 0
      while (x != 0):
          x = (x // 10)
          n = (n + 1)
      x = temp
      sm = 0
      while (x != 0):
          sm = (sm + int(math.pow((x % 10), n)))
          x = (x // 10)
      return (sm == temp)
source_cpp: bool program_check_plus_perfect_number(int x) {
    int temp = x;
    int n = 0;
    while ( x != 0 ) {
      x /= 10;
      n ++;
    }
    x = temp;
    int sum = 0;
    while ( x != 0 ) {
      sum += pow ( x % 10, n );
      x /= 10;
    }
    return ( sum == temp );
  }