title: Program To Find Remainder Without Using Modulo Or Operator 1
signature: func programToFindRemainderWithoutUsingModuloOrOperator1(num int, divisor int) int {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int, expected int) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(num int, divisor int, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(num, divisor),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(34, 
  	55, 34)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(63, 
  	22, 19)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(15, 
  	26, 15)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(56, 
  	58, 56)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(63, 
  	94, 63)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(28, 
  	45, 28)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(54, 
  	97, 54)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(2, 
  	58, 2)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(94, 
  	91, 3)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(82, 
  	40, 2)
      fmt.Printf("TEST-9...%s\n", 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 );
  }