summaryrefslogtreecommitdiffstats
path: root/inf/zotks/1/prog.c
diff options
context:
space:
mode:
authorsijanec <anton@sijanec.eu>2021-02-11 18:01:40 +0100
committersijanec <anton@sijanec.eu>2021-02-11 18:01:40 +0100
commitfe9f8b1bdde07a564e9097e4b2bb433634690983 (patch)
tree35db8d767e7845776fab9aedb687093fdb05b544 /inf/zotks/1/prog.c
parentdokument.md ang readings 9 (diff)
downloadsola-gimb-2-fe9f8b1bdde07a564e9097e4b2bb433634690983.tar
sola-gimb-2-fe9f8b1bdde07a564e9097e4b2bb433634690983.tar.gz
sola-gimb-2-fe9f8b1bdde07a564e9097e4b2bb433634690983.tar.bz2
sola-gimb-2-fe9f8b1bdde07a564e9097e4b2bb433634690983.tar.lz
sola-gimb-2-fe9f8b1bdde07a564e9097e4b2bb433634690983.tar.xz
sola-gimb-2-fe9f8b1bdde07a564e9097e4b2bb433634690983.tar.zst
sola-gimb-2-fe9f8b1bdde07a564e9097e4b2bb433634690983.zip
Diffstat (limited to 'inf/zotks/1/prog.c')
-rw-r--r--inf/zotks/1/prog.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/inf/zotks/1/prog.c b/inf/zotks/1/prog.c
new file mode 100644
index 0000000..f3e38f6
--- /dev/null
+++ b/inf/zotks/1/prog.c
@@ -0,0 +1,27 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+size_t veriga (size_t n, size_t s) {
+ for (size_t i = 2; i <= n; i++) {
+ if (n % i != 0)
+ return veriga(i, s+1);
+ }
+ return s;
+}
+
+int main (int argc, char ** argv) {
+ size_t i;
+ char in[128];
+ fgets(in, 127, stdin);
+ char * p;
+ size_t a = strtoll(in, &p, 10);
+ size_t b = strtoll(p, NULL, 10);
+ size_t sum = 0;
+ /* fprintf(stderr, "%lu, %lu\n", a, b); */
+ for (size_t x = a; x <= b; x++) {
+ sum += veriga(x, 1);
+ }
+ fprintf(stdout, "%lu\n", sum);
+ return 0;
+}