title: Program To Find Remainder Without Using Modulo Or Operator 1
signature: program_to_find_remainder_without_using_modulo_or_operator_1 <- function(num, divisor) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(num, divisor, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(num, divisor), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          34L, 55L, 
          34L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          63L, 22L, 
          19L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          15L, 26L, 
          15L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          56L, 58L, 
          56L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          63L, 94L, 
          63L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          28L, 45L, 
          28L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          54L, 97L, 
          54L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          2L, 58L, 
          2L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          94L, 91L, 
          3L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          82L, 40L, 
          2L
      )))
  
  }
  
  main()
source_py: def program_to_find_remainder_without_using_modulo_or_operator_1(num, divisor):
      if (divisor == 0):
          return False
      if (divisor < 0):
          divisor = (- divisor)
      if (num < 0):
          num = (- num)
      i = 1
      product = 0
      while (product <= num):
          product = (divisor * i)
          i += 1
      return (num - (product - divisor))
source_cpp: int program_to_find_remainder_without_using_modulo_or_operator_1(int num, int divisor) {
    if ( divisor == 0 ) {
      return - 1;
    }
    if ( divisor < 0 ) divisor = - divisor;
    if ( num < 0 ) num = - num;
    int i = 1;
    int product = 0;
    while ( product <= num ) {
      product = divisor * i;
      i ++;
    }
    return num - ( product - divisor );
  }