From 2f127dea98112fbcb06b2bf35d37367b816a0da6 Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Wed, 8 Jun 2022 12:59:43 +0200 Subject: [PATCH] Before adding pointer idea --- euler.kl | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/euler.kl b/euler.kl index bc6e0f0..931429f 100644 --- a/euler.kl +++ b/euler.kl @@ -1,13 +1,15 @@ - +// @todo: Add more stats in the preview +// @todo: for 0..1000(implicit i) and for i in 0..1000 +// @todo: Add blocks of stmts that you can simply define inside a function etc. entry :: () printf("\n") euler1() euler3() -// @todo: Add more stats in the preview -// @todo: for 0..1000(implicit i) and for i in 0..1000 -// @todo: Add blocks of stmts that you can simply define inside a function etc. +//----------------------------------------------------------------------------- +// Euler 2 +//----------------------------------------------------------------------------- euler1 :: () end := 1000 result := 0 @@ -19,6 +21,9 @@ euler1 :: () printf("Euler1: %lld\n", result) +//----------------------------------------------------------------------------- +// Euler 3 +//----------------------------------------------------------------------------- int_sqrt :: (s: S64): S64 result := sqrt(cast(s: F64)) return cast(result: S64) @@ -52,6 +57,7 @@ euler3 :: () results[results_len++] = i n /= i + // Then check if our number is a prime it self if n > 2 results[results_len++] = n @@ -64,6 +70,10 @@ euler3 :: () printf(":: %lld", is_correct) +//----------------------------------------------------------------------------- +// Euler 4 +//----------------------------------------------------------------------------- + print_int :: (i: S64)