Browse Source

multiplication octal numbers

remotes/origin/multiplication
fdai7930 11 months ago
parent
commit
df7be46b47
  1. 12
      src/multiplication.c
  2. 1
      src/multiplication.h

12
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;
}

1
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

Loading…
Cancel
Save