aboutsummaryrefslogtreecommitdiff
path: root/entries/komodoooo/fib.cr
diff options
context:
space:
mode:
authorKomodo2022-10-27 18:29:41 +0000
committerGitHub2022-10-27 18:29:41 +0000
commit8799ce484f9a80b675cc8844c68ee432ac07024e (patch)
tree53956ac9b91e2e6ca0b274367832181e5ff55eb7 /entries/komodoooo/fib.cr
parentbd23ee895a521a62cd909083ee5d3d9c6124eeb2 (diff)
Create fib.cr
Diffstat (limited to 'entries/komodoooo/fib.cr')
-rw-r--r--entries/komodoooo/fib.cr9
1 files changed, 9 insertions, 0 deletions
diff --git a/entries/komodoooo/fib.cr b/entries/komodoooo/fib.cr
new file mode 100644
index 0000000..f15ca3b
--- /dev/null
+++ b/entries/komodoooo/fib.cr
@@ -0,0 +1,9 @@
+def fibonacci(n)
+ a,b=0,1
+ while a < n
+ puts "#{a} "
+ a,b=b,a+b
+ end
+end
+print "Number: "
+fibonacci(gets.not_nil!.to_i)