diff --git a/src/multiplication.c b/src/multiplication.c index d0fcf59..e222e4d 100644 --- a/src/multiplication.c +++ b/src/multiplication.c @@ -1,7 +1,7 @@ #include "multiplication.h" #include #include - +#include double multi( double ein1, double ein2) { @@ -31,7 +31,7 @@ float multiply_by_percentage(float num, float percentage) { } int multiply_by_random(int num) { - int random_factor = rand() % 10 + 1; + int random_factor = random_factor % 10 + 1; return num * random_factor; } @@ -108,5 +108,9 @@ int multiply_using_increment(int num1, int num2) { return result; } +int multiply_by_prime_and_its_square(int num, int prime) { + return num * (prime + square (prime)); +} + diff --git a/src/multiplication.h b/src/multiplication.h index 4955c4d..bd20e4a 100644 --- a/src/multiplication.h +++ b/src/multiplication.h @@ -17,6 +17,7 @@ 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); +int multiply_by_prime_and_its_square(int num, int prime); #endif // MULTIPLICATION_H