Last active
September 8, 2018 14:26
-
-
Save navneetgupta/70cc53e8a77aeb31b36db28904fc81a7 to your computer and use it in GitHub Desktop.
Revisions
-
navneetgupta revised this gist
Sep 8, 2018 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ defmodule FibonacciCalc do def fibonacci(x) when x <= 0, do: IO.puts "Enter a number greater than 0" @@ -12,5 +11,4 @@ defmodule FibonacciCalc do IO.puts "#{first}" calculate_fibonacci(x-1,second, first+second) end end -
navneetgupta created this gist
Sep 8, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ ``` defmodule FibonacciCalc do def fibonacci(x) when x <= 0, do: IO.puts "Enter a number greater than 0" def fibonacci(x) do calculate_fibonacci(x,1,1) end def calculate_fibonacci(x, first, _second ) when x == 1, do: IO.puts "#{first}" def calculate_fibonacci(x, first, second ) do IO.puts "#{first}" calculate_fibonacci(x-1,second, first+second) end end ````