diff options
author | sijanec <sijanecantonluka@gmail.com> | 2020-12-23 09:07:24 +0100 |
---|---|---|
committer | sijanec <sijanecantonluka@gmail.com> | 2020-12-23 09:07:24 +0100 |
commit | 4948201de05f9a44cd15e1f9f187746bcd96fbca (patch) | |
tree | 2fa7cb0e9747d6c7e91db3577da050449684d903 /mat/advent/8/prog.c | |
parent | sprasevanje_nem_1_wetter_heute (diff) | |
download | sola-gimb-2-4948201de05f9a44cd15e1f9f187746bcd96fbca.tar sola-gimb-2-4948201de05f9a44cd15e1f9f187746bcd96fbca.tar.gz sola-gimb-2-4948201de05f9a44cd15e1f9f187746bcd96fbca.tar.bz2 sola-gimb-2-4948201de05f9a44cd15e1f9f187746bcd96fbca.tar.lz sola-gimb-2-4948201de05f9a44cd15e1f9f187746bcd96fbca.tar.xz sola-gimb-2-4948201de05f9a44cd15e1f9f187746bcd96fbca.tar.zst sola-gimb-2-4948201de05f9a44cd15e1f9f187746bcd96fbca.zip |
Diffstat (limited to 'mat/advent/8/prog.c')
-rw-r--r-- | mat/advent/8/prog.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/mat/advent/8/prog.c b/mat/advent/8/prog.c new file mode 100644 index 0000000..7597ae6 --- /dev/null +++ b/mat/advent/8/prog.c @@ -0,0 +1,24 @@ +#include <stdio.h> +#include <stdlib.h> +int main (int argc, char ** argv) { + char x[69] = ""; + int vsebuje = 0; + int j = 0; + int z = 0; + for (int i = 1; i <= 2021; i++) { + sprintf(x, "%d", i); + vsebuje = 0; + for (j = 0; j <= 1234; j++) { + if (x[j] == '1') { + vsebuje = 1; + } + if (x[j] == '\0') { + break; + } + } + if (vsebuje == 0) { + z++; + } + } + fprintf(stdout, "%d \n", z); +} |