title: Program To Find Remainder Without Using Modulo Or Operator 1
signature: function program_to_find_remainder_without_using_modulo_or_operator_1(num, divisor)
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 );
  }
question_info.entry_fn_name: program_to_find_remainder_without_using_modulo_or_operator_1
question_info.entry_cls_name: Solution
question_info.test_case_ids: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
question_info.test_code: 
  
  -- SOLUTION CODE
  -- ============================================
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  function isCorrect(actual, expected)
      if type(expected) ~= type(actual) then
          return false
      end
      
      if type(expected) == 'table' then
          for k,v_expected in pairs(expected) do
              
              if actual[k] == nil then
                  return false
              end
              local v_actual = actual[k]
              if not isCorrect(v_actual, v_expected) then
                  return false
              end
              actual[k]=nil
          end
      
          if next(actual) then 
              return false
          end
          return true
      else
          return actual == expected
      end
  end
  
  function validateSolution(actual, expected)
      return isCorrect(actual,expected)
  end
  
  function driver(num, divisor, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(num, divisor) 
      end)
      if status then
          if validateSolution(exec_result,expected) then
              return "PASSED"
          end
          return "FAILED"
      else
          return string.format("ERROR=%s",string.gsub(error_msg,".*:[%d]+: ",""))
      end
  end
      
  function main()
      result = driver(34, 55, 34)
      print(string.format("TEST-0...%s",result))
  
      result = driver(63, 22, 19)
      print(string.format("TEST-1...%s",result))
  
      result = driver(15, 26, 15)
      print(string.format("TEST-2...%s",result))
  
      result = driver(56, 58, 56)
      print(string.format("TEST-3...%s",result))
  
      result = driver(63, 94, 63)
      print(string.format("TEST-4...%s",result))
  
      result = driver(28, 45, 28)
      print(string.format("TEST-5...%s",result))
  
      result = driver(54, 97, 54)
      print(string.format("TEST-6...%s",result))
  
      result = driver(2, 58, 2)
      print(string.format("TEST-7...%s",result))
  
      result = driver(94, 91, 3)
      print(string.format("TEST-8...%s",result))
  
      result = driver(82, 40, 2)
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
question_info.test_list: [{"idx": 0, "outputs": 34, "inputs": {"num": 34, "divisor": 55}}, {"idx": 1, "outputs": 19, "inputs": {"num": 63, "divisor": 22}}, {"idx": 2, "outputs": 15, "inputs": {"num": 15, "divisor": 26}}, {"idx": 3, "outputs": 56, "inputs": {"num": 56, "divisor": 58}}, {"idx": 4, "outputs": 63, "inputs": {"num": 63, "divisor": 94}}, {"idx": 5, "outputs": 28, "inputs": {"num": 28, "divisor": 45}}, {"idx": 6, "outputs": 54, "inputs": {"num": 54, "divisor": 97}}, {"idx": 7, "outputs": 2, "inputs": {"num": 2, "divisor": 58}}, {"idx": 8, "outputs": 3, "inputs": {"num": 94, "divisor": 91}}, {"idx": 9, "outputs": 2, "inputs": {"num": 82, "divisor": 40}}]