title: Program Check Plus Perfect Number
signature: function programCheckPlusPerfectNumber($x) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return serialize($actual) == serialize($expected);
  }
  
  function driver($x, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($x), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        371, 
        true));
      
      printf("TEST-1...%s\n",driver(
        9474, 
        true));
      
      printf("TEST-2...%s\n",driver(
        85, 
        false));
      
      printf("TEST-3...%s\n",driver(
        35, 
        false));
      
      printf("TEST-4...%s\n",driver(
        54, 
        false));
      
      printf("TEST-5...%s\n",driver(
        17, 
        false));
      
      printf("TEST-6...%s\n",driver(
        97, 
        false));
      
      printf("TEST-7...%s\n",driver(
        63, 
        false));
      
      printf("TEST-8...%s\n",driver(
        12, 
        false));
      
      printf("TEST-9...%s\n",driver(
        43, 
        false));
      
  }
  
  main();
  ?>
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 );
  }