title: Divisibility By 7
signature: divisibility_by_7 <- function(num) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(num, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(num), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          0L, 
          TRUE
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          -21L, 
          FALSE
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          7L, 
          TRUE
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          63L, 
          FALSE
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          84L, 
          FALSE
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          73L, 
          FALSE
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          81L, 
          FALSE
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          -10L, 
          FALSE
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          47L, 
          FALSE
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          23L, 
          FALSE
      )))
  
  }
  
  main()
source_py: def divisibility_by_7(num):
      if (num < 0):
          return divisibility_by_7((- num))
      if ((num == 0) or (num == 7)):
          return True
      if (num < 10):
          return False
      return divisibility_by_7(((num / 10) - (2 * (num - ((num / 10) * 10)))))
source_cpp: int divisibility_by_7(int num) {
    if ( num < 0 ) return divisibility_by_7 ( - num );
    if ( num == 0 || num == 7 ) return 1;
    if ( num < 10 ) return 0;
    return divisibility_by_7 ( num / 10 - 2 * ( num - num / 10 * 10 ) );
  }