title: Program Check Plus Perfect Number
signature: programCheckPlusPerfectNumber(x) {
test_code: import 'dart:convert';
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(bool actual, bool expected){
      return actual.toString() == expected.toString();
  }
  
  String driver(x, bool expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(x), expected)){
              return "PASSED";
          }
          return "FAILED";
      }catch(exception_object){
          return exception_object.runtimeType.toString();
      }
  }
  
  int main() {
  
      print("TEST-0...${driver(
          371, 
          true)
      }");
  
      print("TEST-1...${driver(
          9474, 
          true)
      }");
  
      print("TEST-2...${driver(
          85, 
          false)
      }");
  
      print("TEST-3...${driver(
          35, 
          false)
      }");
  
      print("TEST-4...${driver(
          54, 
          false)
      }");
  
      print("TEST-5...${driver(
          17, 
          false)
      }");
  
      print("TEST-6...${driver(
          97, 
          false)
      }");
  
      print("TEST-7...${driver(
          63, 
          false)
      }");
  
      print("TEST-8...${driver(
          12, 
          false)
      }");
  
      print("TEST-9...${driver(
          43, 
          false)
      }");
  
      return 0;
  }
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 );
  }