summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsijanec <sijanecantonluka@gmail.com>2020-12-07 12:15:55 +0100
committersijanec <sijanecantonluka@gmail.com>2020-12-07 12:15:55 +0100
commitcae0c0f2d40e2ced764c99a80ccc065e7c5e3819 (patch)
treed2af30f2fb15ddeb4f5844435b78ad1897e05638
parentnekaj ćaral pri eulerju, ampak pretežko.. ju3 (diff)
downloadsola-gimb-2-cae0c0f2d40e2ced764c99a80ccc065e7c5e3819.tar
sola-gimb-2-cae0c0f2d40e2ced764c99a80ccc065e7c5e3819.tar.gz
sola-gimb-2-cae0c0f2d40e2ced764c99a80ccc065e7c5e3819.tar.bz2
sola-gimb-2-cae0c0f2d40e2ced764c99a80ccc065e7c5e3819.tar.lz
sola-gimb-2-cae0c0f2d40e2ced764c99a80ccc065e7c5e3819.tar.xz
sola-gimb-2-cae0c0f2d40e2ced764c99a80ccc065e7c5e3819.tar.zst
sola-gimb-2-cae0c0f2d40e2ced764c99a80ccc065e7c5e3819.zip
Diffstat (limited to '')
-rw-r--r--mat/advent/4/Makefile2
-rwxr-xr-xmat/advent/4/a.outbin0 -> 8432 bytes
-rw-r--r--mat/advent/4/prog.c18
3 files changed, 20 insertions, 0 deletions
diff --git a/mat/advent/4/Makefile b/mat/advent/4/Makefile
new file mode 100644
index 0000000..4296acc
--- /dev/null
+++ b/mat/advent/4/Makefile
@@ -0,0 +1,2 @@
+default:
+ gcc prog.c -pedantic
diff --git a/mat/advent/4/a.out b/mat/advent/4/a.out
new file mode 100755
index 0000000..ad1aa04
--- /dev/null
+++ b/mat/advent/4/a.out
Binary files differ
diff --git a/mat/advent/4/prog.c b/mat/advent/4/prog.c
new file mode 100644
index 0000000..87dfa5e
--- /dev/null
+++ b/mat/advent/4/prog.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <stdlib.h>
+int main (int argc, char ** argv) {
+ if (argc != 1+1) {
+ fprintf(stderr, "uporaba: %s <dolzina stranice kvadratne mreze>\nprimer za šahovnico: %s 8\n", argv[0], argv[0]);
+ return 1;
+ }
+ unsigned long int n = strtol(argv[1], NULL, 10);
+ unsigned long int x = 1;
+ unsigned long int y = 1;
+ unsigned long int s = 0;
+ for (x = 1; x <= n; x++) {
+ fprintf(stderr, "debug: x == %lu\n", x);
+ for (y = 1; y <= n; y++)
+ s = s + x * y;
+ }
+ fprintf(stdout, "seštevek možnih pravokotnikov v mreži %lux%lu je %lu\n", n, n, s);
+}