From 763a29f6aac8951db18659738dca7782ac4f3010 Mon Sep 17 00:00:00 2001 From: Hendrik Sitzmann Date: Thu, 8 Feb 2024 12:05:26 +0100 Subject: [PATCH] added function to primzahl.c --- src/primzahl/primzahl.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/primzahl/primzahl.c b/src/primzahl/primzahl.c index e69de29..1d74d73 100644 --- a/src/primzahl/primzahl.c +++ b/src/primzahl/primzahl.c @@ -0,0 +1,13 @@ +#include +#include + +bool primzahl(int num) { + if (num <= 1) + return false; + + for (int i = 2; i < num; i++) { + if (num % i == 0) + return false; + } + return true; +} \ No newline at end of file