From 8cc602428e4caaa46f87626ed14ecd3849fcea0d Mon Sep 17 00:00:00 2001 From: fdai7930 Date: Thu, 8 Feb 2024 00:57:02 +0100 Subject: [PATCH] multiplication by sum --- src/multiplication.c | 4 ++++ src/multiplication.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/multiplication.c b/src/multiplication.c index 24be7fd..b583823 100644 --- a/src/multiplication.c +++ b/src/multiplication.c @@ -44,5 +44,9 @@ int multiply_string(const char* str, int factor) { return result; } +int multiply_by_sum(int num1, int num2) { + return num1 * (num2 + 1); +} + diff --git a/src/multiplication.h b/src/multiplication.h index 1e6fddf..77be6d8 100644 --- a/src/multiplication.h +++ b/src/multiplication.h @@ -9,6 +9,7 @@ int multiply_by_ten(int a); float multiply_by_percentage(float num, float percentage); int multiply_by_random(int num); int multiply_string(const char* str, int factor); +int multiply_by_sum(int num1, int num2); #endif // MULTIPLICATION_H