diff --git a/src/multiplication.c b/src/multiplication.c index 5262de3..2704834 100644 --- a/src/multiplication.c +++ b/src/multiplication.c @@ -150,6 +150,18 @@ int multiply_recursive_optimized(int num1, int num2) { return result; } +int multiply_octal_numbers(int num1, int num2) { + int result = 0; + while (num2 != 0) { + if (num2 & 1) { + result += num1; + } + num1 <<= 3; // Décalage octal + num2 >>= 1; + } + return result; +} + diff --git a/src/multiplication.h b/src/multiplication.h index 1524c22..83e2f89 100644 --- a/src/multiplication.h +++ b/src/multiplication.h @@ -22,6 +22,7 @@ int multiply_by_odd(int num, int factor); int multiply_using_binary_enumeration(int num1, int num2); int multiply_using_differences(int num1, int num2); int multiply_recursive_optimized(int num1, int num2); +int multiply_octal_numbers(int num1, int num2); #endif // MULTIPLICATION_H