diff options
author | sijanec <sijanecantonluka@gmail.com> | 2020-12-11 23:28:35 +0100 |
---|---|---|
committer | sijanec <sijanecantonluka@gmail.com> | 2020-12-11 23:28:35 +0100 |
commit | 269d3fa92201f468a30215773d9a3fd40bc430e3 (patch) | |
tree | f5429e8b83d3e45bbee4b4fb7eb5b3df437a26ef /mat | |
parent | advent 5 (diff) | |
download | sola-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/Makefile | 3 | ||||
-rwxr-xr-x | mat/advent/6/a.out | bin | 0 -> 8344 bytes | |||
-rwxr-xr-x | mat/advent/6/n1 | bin | 0 -> 8344 bytes | |||
-rw-r--r-- | mat/advent/6/n1.c | 14 | ||||
-rw-r--r-- | mat/advent/6/prog.c | 13 |
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 Binary files differnew file mode 100755 index 0000000..2b0aca5 --- /dev/null +++ b/mat/advent/6/a.out diff --git a/mat/advent/6/n1 b/mat/advent/6/n1 Binary files differnew file mode 100755 index 0000000..1ca7db2 --- /dev/null +++ b/mat/advent/6/n1 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; +} |