title: Divisibility 9 Using Bitwise Operators
signature: def divisibility9UsingBitwiseOperators(n: 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(n: Int, expected: Boolean): String = {
      try {
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)) {
              "PASSED"
          } else{
              "FAILED"
          }
      }catch{
          case e: Exception => {e.getClass.getName}
      }
  
  }
  object QuestionEvaluator extends App {
  
      println(s"TEST-0...${driver(
        96, 
        false    
      )}")   
  
  
      println(s"TEST-1...${driver(
        85, 
        false    
      )}")   
  
  
      println(s"TEST-2...${driver(
        54, 
        true    
      )}")   
  
  
      println(s"TEST-3...${driver(
        14, 
        false    
      )}")   
  
  
      println(s"TEST-4...${driver(
        47, 
        false    
      )}")   
  
  
      println(s"TEST-5...${driver(
        11, 
        false    
      )}")   
  
  
      println(s"TEST-6...${driver(
        49, 
        false    
      )}")   
  
  
      println(s"TEST-7...${driver(
        99, 
        true    
      )}")   
  
  
      println(s"TEST-8...${driver(
        28, 
        false    
      )}")   
  
  
      println(s"TEST-9...${driver(
        82, 
        false    
      )}")   
  
  }
  
source_py: def divisibility_9_using_bitwise_operators(n):
      if ((n == 0) or (n == 9)):
          return True
      if (n < 9):
          return False
      return divisibility_9_using_bitwise_operators((int((n >> 3)) - int((n & 7))))
source_cpp: bool divisibility_9_using_bitwise_operators(int n) {
    if ( n == 0 || n == 9 ) return true;
    if ( n < 9 ) return false;
    return divisibility_9_using_bitwise_operators ( ( int ) ( n >> 3 ) - ( int ) ( n & 7 ) );
  }