summaryrefslogtreecommitdiff
path: root/rushs/tinyprintf/sieve_eratosthenes_advanced
diff options
context:
space:
mode:
authorMartial Simon <msimon_fr@hotmail.com>2025-10-11 22:19:00 +0200
committerMartial Simon <msimon_fr@hotmail.com>2025-10-11 22:19:00 +0200
commit73c2b00a10c5786ddeeacc915e233fd4df1c9321 (patch)
treee299ea4e8ac161b2b21170172ff8f182c1c3fe1a /rushs/tinyprintf/sieve_eratosthenes_advanced
parentc9b6b9a5ca082fe7c1b6f58d7713f785a9eb6a5c (diff)
fix: evalexpr & tinyprintf contenaient toute la piscine
Diffstat (limited to 'rushs/tinyprintf/sieve_eratosthenes_advanced')
-rw-r--r--rushs/tinyprintf/sieve_eratosthenes_advanced/Makefile13
-rw-r--r--rushs/tinyprintf/sieve_eratosthenes_advanced/sieve.c39
2 files changed, 0 insertions, 52 deletions
diff --git a/rushs/tinyprintf/sieve_eratosthenes_advanced/Makefile b/rushs/tinyprintf/sieve_eratosthenes_advanced/Makefile
deleted file mode 100644
index c7e35f9..0000000
--- a/rushs/tinyprintf/sieve_eratosthenes_advanced/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-CC=gcc
-CFLAGS=-std=c99 -Wall -Wextra -Werror -Wvla -pedantic
-LDLIBS=
-
-all: sieve.o
-
-sieve.o: sieve.c
- $(CC) $(CFLAGS) -c -o sieve.o sieve.c
-
-.PHONY: clean
-
-clean:
- rm sieve.o
diff --git a/rushs/tinyprintf/sieve_eratosthenes_advanced/sieve.c b/rushs/tinyprintf/sieve_eratosthenes_advanced/sieve.c
deleted file mode 100644
index 7dd4816..0000000
--- a/rushs/tinyprintf/sieve_eratosthenes_advanced/sieve.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-
-void sieve(int n)
-{
- if (n <= 2)
- {
- return;
- }
-
- // Generate array
- int *a = calloc(n, sizeof(int));
- int count = 0;
-
- // Actual sieve and count
- for (int i = 2; i < n; i++)
- {
- if (a[i] == 0)
- {
- for (int k = 2 * i; k < n; k += i)
- {
- a[k] = 1;
- }
- }
- }
-
- for (int i = 2; i < n; i++)
- {
- if (a[i] == 0)
- {
- count++;
- }
- }
-
- // Print the count
- printf("%d\n", count);
-
- free(a);
-}