diff options
Diffstat (limited to 'inf/zotks/1/prog.c')
-rw-r--r-- | inf/zotks/1/prog.c | 27 |
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; +} |