summaryrefslogtreecommitdiffstats
path: root/mat
diff options
context:
space:
mode:
authorsijanec <sijanecantonluka@gmail.com>2020-12-11 23:28:35 +0100
committersijanec <sijanecantonluka@gmail.com>2020-12-11 23:28:35 +0100
commit269d3fa92201f468a30215773d9a3fd40bc430e3 (patch)
treef5429e8b83d3e45bbee4b4fb7eb5b3df437a26ef /mat
parentadvent 5 (diff)
downloadsola-gimb-2-269d3fa92201f468a30215773d9a3fd40bc430e3.tar
sola-gimb-2-269d3fa92201f468a30215773d9a3fd40bc430e3.tar.gz
sola-gimb-2-269d3fa92201f468a30215773d9a3fd40bc430e3.tar.bz2
sola-gimb-2-269d3fa92201f468a30215773d9a3fd40bc430e3.tar.lz
sola-gimb-2-269d3fa92201f468a30215773d9a3fd40bc430e3.tar.xz
sola-gimb-2-269d3fa92201f468a30215773d9a3fd40bc430e3.tar.zst
sola-gimb-2-269d3fa92201f468a30215773d9a3fd40bc430e3.zip
Diffstat (limited to 'mat')
-rw-r--r--mat/advent/6/Makefile3
-rwxr-xr-xmat/advent/6/a.outbin0 -> 8344 bytes
-rwxr-xr-xmat/advent/6/n1bin0 -> 8344 bytes
-rw-r--r--mat/advent/6/n1.c14
-rw-r--r--mat/advent/6/prog.c13
5 files changed, 30 insertions, 0 deletions
diff --git a/mat/advent/6/Makefile b/mat/advent/6/Makefile
new file mode 100644
index 0000000..1e287d6
--- /dev/null
+++ b/mat/advent/6/Makefile
@@ -0,0 +1,3 @@
+default:
+ gcc -pedantic prog.c
+ gcc -pedantic n1.c -on1
diff --git a/mat/advent/6/a.out b/mat/advent/6/a.out
new file mode 100755
index 0000000..2b0aca5
--- /dev/null
+++ b/mat/advent/6/a.out
Binary files differ
diff --git a/mat/advent/6/n1 b/mat/advent/6/n1
new file mode 100755
index 0000000..1ca7db2
--- /dev/null
+++ b/mat/advent/6/n1
Binary files differ
diff --git a/mat/advent/6/n1.c b/mat/advent/6/n1.c
new file mode 100644
index 0000000..4f4a5a2
--- /dev/null
+++ b/mat/advent/6/n1.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+#include <stdlib.h>
+int main (int argc, char ** argv) {
+ unsigned int s = 1; /* seštevek */
+ unsigned int i = 0; /* indeks */
+ while (1) {
+ i++;
+ s = s*3;
+ if (s > 2020)
+ break;
+ }
+ fprintf(stdout, "H_%u ima ploščino, enako %u-kratniku ploščine H_0.\n", i, s);
+ return 0;
+}
diff --git a/mat/advent/6/prog.c b/mat/advent/6/prog.c
new file mode 100644
index 0000000..14eb68a
--- /dev/null
+++ b/mat/advent/6/prog.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <stdlib.h>
+int main (int argc, char ** argv) {
+ double x;
+ size_t s = 0;
+ for (double a = 1; a <= 2020; a++) {
+ x = ((float)7/(float)5)*(float)a;
+ if (x == (int)x)
+ s++;
+ }
+ fprintf(stderr, "%lu\n", s);
+ return 0;
+}