Browse Source

repeated division multiplication fonction added

remotes/origin/multiplication
fdai7930 11 months ago
parent
commit
6247b18422
  1. 14
      src/multiplication.c
  2. 1
      src/multiplication.h

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

1
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);

Loading…
Cancel
Save