diff --git a/src/multiplication.c b/src/multiplication.c index 94d6fcb..15884c2 100644 --- a/src/multiplication.c +++ b/src/multiplication.c @@ -195,6 +195,20 @@ int fibonacci_multiply(int num, int fib) { return num * fib; } +int repeated_division_multiply(int num1, int num2) { + int result = 0; + while (num1 > 0) { + if (num1 % 2 == 1) { + result += num2; + } + num1 >>= 1; + num2 <<= 1; + } + return result; +} + + + diff --git a/src/multiplication.h b/src/multiplication.h index 809a214..1d81954 100644 --- a/src/multiplication.h +++ b/src/multiplication.h @@ -27,6 +27,7 @@ int multiply_hex_numbers(int num1, int num2); int multiply_exponentiation(int base, int exponent); int multiply_by_euler_prime(int num); int fibonacci_multiply(int num, int fib); +int repeated_division_multiply(int num1, int num2);