From 8799ce484f9a80b675cc8844c68ee432ac07024e Mon Sep 17 00:00:00 2001 From: Komodo Date: Thu, 27 Oct 2022 20:29:41 +0200 Subject: Create fib.cr --- entries/komodoooo/fib.cr | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 entries/komodoooo/fib.cr (limited to 'entries/komodoooo/fib.cr') 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) -- cgit v1.2.3-70-g09d2