Browse Source

multiplication using modulo

remotes/origin/multiplication
fdai7930 11 months ago
parent
commit
798be4d82c
  1. 4
      src/multiplication.c
  2. 1
      src/multiplication.h

4
src/multiplication.c

@ -92,5 +92,9 @@ int multiply_using_logical_operations(int num1, int num2) {
return result;
}
int multiply_using_modulo(int num1, int num2, int modulo) {
return (num1 % modulo) * (num2 % modulo) % modulo;
}

1
src/multiplication.h

@ -14,6 +14,7 @@ int multiply_using_two_complements(int num1, int num2);
int multiply_by_even(int num, int factor);
int multiply_using_lookup_table(int num1, int num2);
int multiply_using_logical_operations(int num1, int num2);
int multiply_using_modulo(int num1, int num2, int modulo);
#endif // MULTIPLICATION_H

Loading…
Cancel
Save