title: Program To Find Remainder Without Using Modulo Or Operator 1
signature: int programToFindRemainderWithoutUsingModuloOrOperator1(int num, int divisor) {
test_code: #include <algorithm>
  #include <assert.h>
  #include <cstdlib>
  #include <iostream>
  #include <map>
  #include <set>
  #include <string>
  #include <tuple> 
  #include <unordered_map>
  #include <vector>
  #include <math.h>
  #include <cmath>
  #include <bits/stdc++.h>
  #include <numeric>
  #include <functional>
  
  using namespace std;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(int actual, int expected){
      return actual == expected;
  }
  
  string driver(int num, int divisor, int expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(num, divisor), expected)){
              return "PASSED";
          }
          return "FAILED";
      }
      catch (const std::overflow_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::runtime_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::exception& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (...)
      {
          return "UNK_ERROR";
      }
  }
  
  int main() {
      string result = "";
  
      result = driver(34, 55, 34); 
      cout << "TEST-" << 0 << "..."
           <<  result
           << "\n";
  
      result = driver(63, 22, 19); 
      cout << "TEST-" << 1 << "..."
           <<  result
           << "\n";
  
      result = driver(15, 26, 15); 
      cout << "TEST-" << 2 << "..."
           <<  result
           << "\n";
  
      result = driver(56, 58, 56); 
      cout << "TEST-" << 3 << "..."
           <<  result
           << "\n";
  
      result = driver(63, 94, 63); 
      cout << "TEST-" << 4 << "..."
           <<  result
           << "\n";
  
      result = driver(28, 45, 28); 
      cout << "TEST-" << 5 << "..."
           <<  result
           << "\n";
  
      result = driver(54, 97, 54); 
      cout << "TEST-" << 6 << "..."
           <<  result
           << "\n";
  
      result = driver(2, 58, 2); 
      cout << "TEST-" << 7 << "..."
           <<  result
           << "\n";
  
      result = driver(94, 91, 3); 
      cout << "TEST-" << 8 << "..."
           <<  result
           << "\n";
  
      result = driver(82, 40, 2); 
      cout << "TEST-" << 9 << "..."
           <<  result
           << "\n";
  
      return 0;
  }
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 );
  }