1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char ** argv) {
if (argc != 1+3) {
fprintf(stderr, "uporaba: %s <od> <do> <n>\nprimer: %s 1000 9999 8499\n", argv[0], argv[0]);
return 1;
}
unsigned long long int o = strtoull(argv[1], NULL, 10);
unsigned long long int d = strtoull(argv[2], NULL, 10);
unsigned long long int n = strtoull(argv[3], NULL, 10);
unsigned long long int i = o;
unsigned long long int j = o;
unsigned long long int s = 0;
for (i = o; i <= d; i++) {
fprintf(stderr, "\rpreostane še %llu iteracij", n-i);
s = 0;
for (j = o; j <= d; j++) {
if (j == i)
continue;
s += j;
}
if (n * i == s)
break;
}
fprintf(stdout, "\rče seštejemo vsa števila od %llu do %llu, razen %llu, bo\n"
"vsota vseh %llu, kar je %llu*%llu.\n", o, d, i, s, n, i);
return 0;
}
|