From f73479c01997a6663024b7e701726ba5aa3c2e2e Mon Sep 17 00:00:00 2001 From: fdai7930 Date: Fri, 9 Feb 2024 14:25:35 +0100 Subject: [PATCH] added multiplication_repetition function --- src/multiplication.c | 9 +++++++++ src/multiplication.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/multiplication.c b/src/multiplication.c index f2ddf1c..455175f 100644 --- a/src/multiplication.c +++ b/src/multiplication.c @@ -236,6 +236,15 @@ int karatsu_multi(int num1, int num2) { } +int multiplication_repetition(int a, int n) { + int resultat = 0; + for (int i = 0; i < n; i++) { + resultat += a; + } + return resultat; +} + + diff --git a/src/multiplication.h b/src/multiplication.h index 52fdcf4..52e2641 100644 --- a/src/multiplication.h +++ b/src/multiplication.h @@ -31,6 +31,7 @@ int bernoulli_multi(int num, int bernoulli); float power_multi(float base, int exponent); int bitwisee_multi(int num1, int num2); int karatsu_multi(int num1, int num2); +int multiplication_repetition(int a, int n);