title: Program To Find Remainder Without Using Modulo Or Operator 1
signature: class Solution {
  
      public int ProgramToFindRemainderWithoutUsingModuloOrOperator1(int num, int divisor) {
test_code: using System;
  using System.Numerics;
  using System.Diagnostics;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Security.Cryptography;
  using System.Web.UI;
  using System.Web.Script.Serialization;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  namespace EvaluatePrediction {
      class TestRunner {
          public bool ValidateSolution(int actual, int expected){
              return new JavaScriptSerializer().Serialize(actual) == new JavaScriptSerializer().Serialize(expected);
          }
  
          public string driver(int num, int divisor, int expected){
              try{
                PLACEHOLDER_CLS_NAME solution_cls = new PLACEHOLDER_CLS_NAME();
                int pred_result = solution_cls.PLACEHOLDER_FN_NAME(num, divisor); 
                if (ValidateSolution(
                      pred_result,
                      expected)){
                  return "PASSED";
                }
                return "FAILED";
              } 
              catch (Exception exception_obj)
              {
                return exception_obj.GetType().FullName;
              }
          }
          static void Main(string[] args) {
              TestRunner runner = new TestRunner();
              String result;
              result = runner.driver(
                  34, 55, 
                  34
              );
              Console.WriteLine(string.Format(
                  "TEST-0...{0}",
                  result)
              );result = runner.driver(
                  63, 22, 
                  19
              );
              Console.WriteLine(string.Format(
                  "TEST-1...{0}",
                  result)
              );result = runner.driver(
                  15, 26, 
                  15
              );
              Console.WriteLine(string.Format(
                  "TEST-2...{0}",
                  result)
              );result = runner.driver(
                  56, 58, 
                  56
              );
              Console.WriteLine(string.Format(
                  "TEST-3...{0}",
                  result)
              );result = runner.driver(
                  63, 94, 
                  63
              );
              Console.WriteLine(string.Format(
                  "TEST-4...{0}",
                  result)
              );result = runner.driver(
                  28, 45, 
                  28
              );
              Console.WriteLine(string.Format(
                  "TEST-5...{0}",
                  result)
              );result = runner.driver(
                  54, 97, 
                  54
              );
              Console.WriteLine(string.Format(
                  "TEST-6...{0}",
                  result)
              );result = runner.driver(
                  2, 58, 
                  2
              );
              Console.WriteLine(string.Format(
                  "TEST-7...{0}",
                  result)
              );result = runner.driver(
                  94, 91, 
                  3
              );
              Console.WriteLine(string.Format(
                  "TEST-8...{0}",
                  result)
              );result = runner.driver(
                  82, 40, 
                  2
              );
              Console.WriteLine(string.Format(
                  "TEST-9...{0}",
                  result)
              );
          }
      }
  }
  
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 );
  }