From f65e7733a59efe8bfd8cfe33e699c1e750deb274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Tue, 14 May 2024 22:19:27 +0200 Subject: searphp nokia 6020 friendly (button->inputsubmit) --- "\305\241ola/ds2/n4.c" | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 "\305\241ola/ds2/n4.c" (limited to 'šola/ds2') diff --git "a/\305\241ola/ds2/n4.c" "b/\305\241ola/ds2/n4.c" new file mode 100644 index 0000000..23d73ca --- /dev/null +++ "b/\305\241ola/ds2/n4.c" @@ -0,0 +1,25 @@ +#include +#include +#include +#define KVADRAT(x) ((x)*(x)) +int main (int argc, char ** argv) { + assert(argc >= 2); + int n = atoi(argv[1]); + int povezanost[n*n][n*n]; + for (int i = 0; i < n*n; i++) { + for (int j = 0; j < n*n; j++) { + int istolpec = i/n; + int ivrstica = i%n; + int jstolpec = j/n; + int jvrstica = j%n; + povezanost[i][j] = KVADRAT(istolpec-jstolpec)+KVADRAT(jvrstica-ivrstica) == 5 ? 1 : 0; + } + } + for (int i = 0; i < n*n; i++) { + for (int j = 0; j < n*n; j++) { + printf("%d\t", povezanost[i][j]); + } + printf("\n"); + } + return 0; +} -- cgit v1.2.3