From b484b79f1f0f94a9f32cdb781bfc9a5d9ebeae3a Mon Sep 17 00:00:00 2001
From: fdai7930 <salma.zouaghi@informatik.hs-fulda.de>
Date: Thu, 8 Feb 2024 00:48:17 +0100
Subject: [PATCH] multiplication string

---
 src/multiplication.c | 10 ++++++++++
 src/multiplication.h |  2 ++
 2 files changed, 12 insertions(+)

diff --git a/src/multiplication.c b/src/multiplication.c
index cef7c1c..24be7fd 100644
--- a/src/multiplication.c
+++ b/src/multiplication.c
@@ -1,5 +1,7 @@
 #include "multiplication.h"
 #include <stdio.h>
+#include <string.h>
+
 
 
 double multi( double ein1, double ein2) {
@@ -33,6 +35,14 @@ int multiply_by_random(int num) {
     return num * random_factor;
 }
 
+int multiply_string(const char* str, int factor) {
+    int len = strlen(str);
+    int result = 0;
+    for (int i = 0; i < len; i++) {
+        result += str[i] * factor;
+    }
+    return result;
+}
 
     
 
diff --git a/src/multiplication.h b/src/multiplication.h
index 894f020..1e6fddf 100644
--- a/src/multiplication.h
+++ b/src/multiplication.h
@@ -8,6 +8,8 @@ int multiply_right_shift(int a, int b);
 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);
+
 
 #endif // MULTIPLICATION_H