title: Program Check Plus Perfect Number
signature: function program_check_plus_perfect_number(x)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return actual == expected
  end
  
  function driver(x, expected)
      try
  
          if validate_solution(PLACEHOLDER_FN_NAME(x), expected)
              return "PASSED";
          end
          return "FAILED";
      catch exception_obj
          return string(Base.typename(typeof(exception_obj)).wrapper);
      end
  end
  
  function main()
      
      result = driver(371, true);
      @printf("TEST-0...%s\n",result);
      
      result = driver(9474, true);
      @printf("TEST-1...%s\n",result);
      
      result = driver(85, false);
      @printf("TEST-2...%s\n",result);
      
      result = driver(35, false);
      @printf("TEST-3...%s\n",result);
      
      result = driver(54, false);
      @printf("TEST-4...%s\n",result);
      
      result = driver(17, false);
      @printf("TEST-5...%s\n",result);
      
      result = driver(97, false);
      @printf("TEST-6...%s\n",result);
      
      result = driver(63, false);
      @printf("TEST-7...%s\n",result);
      
      result = driver(12, false);
      @printf("TEST-8...%s\n",result);
      
      result = driver(43, false);
      @printf("TEST-9...%s\n",result);
      
  end
  
  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 );
  }