From 5f2b035e1711e741c14622a08c21bb4327945e00 Mon Sep 17 00:00:00 2001
From: "jerome.maison" <jerome.maison@etu.hesge.ch>
Date: Tue, 24 Jan 2023 13:47:23 +0100
Subject: [PATCH] exo4

---
 exo4/Makefile |  7 ++++---
 exo4/exo4.c   | 22 ++++++++++++++++++++++
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/exo4/Makefile b/exo4/Makefile
index 485d39c..15c28c9 100644
--- a/exo4/Makefile
+++ b/exo4/Makefile
@@ -7,8 +7,9 @@ LDFLAGS:=-lm
 
 
 
-ex4: ex4.c
-	$(CC) $(CFLAGS) -c $@ $^ $(LDFLAGS)
+exo4: exo4.c
+	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
+
 
 clean:
-	rm -f *.o ex4
+	rm -f *.o exo4
diff --git a/exo4/exo4.c b/exo4/exo4.c
index e69de29..585c6df 100644
--- a/exo4/exo4.c
+++ b/exo4/exo4.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+
+// table de multiplication
+
+int table_multiplication(int, int);
+
+int main() {
+    int nbr = 0;
+    printf("Entier:\n");
+    scanf("%d", &nbr);
+    printf("table:\n");
+    table_multiplication(nbr, 12);
+}
+
+int table_multiplication(int n, int k){
+    int r = n * k;
+    if(!k){
+        return 0;
+    }
+    printf("%d * %d = %d\n", n, k, r);    
+    return table_multiplication(n, k - 1);   
+}
\ No newline at end of file
-- 
GitLab