Last active
October 1, 2018 17:22
-
-
Save ram0973/e63e539058d631b71f4237f452c69326 to your computer and use it in GitHub Desktop.
Fibonacci in Powershell
This file contains 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 characters
Function Fib($n) { | |
if ($n -lt 2) { | |
return $n | |
} | |
return (Fib($n - 2)) + (Fib($n - 1)) | |
} | |
1..30 | ForEach-Object {Fib -n $_} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment