From f3490b1959578b95675c29f2fb8856e2f4a16905 Mon Sep 17 00:00:00 2001
From: "adrian.spycher" <adrian.spycher@etu.hesge.ch>
Date: Tue, 24 Jan 2023 14:26:28 +0100
Subject: [PATCH] add ex04

---
 ex04/ex04.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/ex04/ex04.c b/ex04/ex04.c
index 913d391..d7fd79c 100644
--- a/ex04/ex04.c
+++ b/ex04/ex04.c
@@ -6,8 +6,31 @@
 #include <stdlib.h>
 #include <stdio.h>
 
+#define MAX_TABLE 12
+
+void print_table(int base, int current)
+{
+    int next = current + base;
+    int div = next / base;
+    printf("%d * %d = %d\n", base, div, next);
+
+    if (next != base * MAX_TABLE)
+    {
+        print_table(base, next);
+    }
+}
+
 int main()
 {
+    int entier;
+    printf("Entier : ");
+    if (scanf("%d", &entier) != 1)
+    {
+        return -1;
+    }
+
+    printf("Table:\n");
+    print_table(entier, 0);
 
     return 0;
 }
-- 
GitLab