diff --git a/src/multiplication.c b/src/multiplication.c index e222e4d..e8e4602 100644 --- a/src/multiplication.c +++ b/src/multiplication.c @@ -112,5 +112,14 @@ int multiply_by_prime_and_its_square(int num, int prime) { return num * (prime + square (prime)); } +int multiply_by_odd(int num, int factor) { + int result = 0; + for (int i = 0; i < factor; ++i) { + result += num; + } + return result; +} + + diff --git a/src/multiplication.h b/src/multiplication.h index bd20e4a..ff24d5e 100644 --- a/src/multiplication.h +++ b/src/multiplication.h @@ -18,6 +18,7 @@ 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); int multiply_by_prime_and_its_square(int num, int prime); +int multiply_by_odd(int num, int factor); #endif // MULTIPLICATION_H