title: Program Check Plus Perfect Number
signature: def programCheckPlusPerfectNumber(x: Int) = {
test_code: import scala.collection.mutable.HashMap
  import scala.collection.immutable.HashSet
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  
  // TESTING CODE 
  // ============================================
  def validateSolution(actual: Boolean , expected: Boolean): Boolean = {
      actual.toString == expected.toString
  }
  
  def driver(x: Int, expected: Boolean): String = {
      try {
          if (validateSolution(PLACEHOLDER_FN_NAME(x),expected)) {
              "PASSED"
          } else{
              "FAILED"
          }
      }catch{
          case e: Exception => {e.getClass.getName}
      }
  
  }
  object QuestionEvaluator extends App {
  
      println(s"TEST-0...${driver(
        371, 
        true    
      )}")   
  
  
      println(s"TEST-1...${driver(
        9474, 
        true    
      )}")   
  
  
      println(s"TEST-2...${driver(
        85, 
        false    
      )}")   
  
  
      println(s"TEST-3...${driver(
        35, 
        false    
      )}")   
  
  
      println(s"TEST-4...${driver(
        54, 
        false    
      )}")   
  
  
      println(s"TEST-5...${driver(
        17, 
        false    
      )}")   
  
  
      println(s"TEST-6...${driver(
        97, 
        false    
      )}")   
  
  
      println(s"TEST-7...${driver(
        63, 
        false    
      )}")   
  
  
      println(s"TEST-8...${driver(
        12, 
        false    
      )}")   
  
  
      println(s"TEST-9...${driver(
        43, 
        false    
      )}")   
  
  }
  
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 );
  }