diff --git a/src/multiplication.c b/src/multiplication.c index 201093f..d0fcf59 100644 --- a/src/multiplication.c +++ b/src/multiplication.c @@ -100,6 +100,13 @@ int multiply_by_prime(int num, int prime) { return num * (prime - 1) + num; } +int multiply_using_increment(int num1, int num2) { + int result = 0; + for (int i = 0; i < num2; ++i) { + result += num1; + } + return result; +} diff --git a/src/multiplication.h b/src/multiplication.h index 26da04e..4955c4d 100644 --- a/src/multiplication.h +++ b/src/multiplication.h @@ -16,6 +16,7 @@ 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); int multiply_by_prime(int num, int prime); +int multiply_using_increment(int num1, int num2); #endif // MULTIPLICATION_H