mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-22 16:03:22 +01:00
Add list-fibonacci.ps1
This commit is contained in:
parent
f9e7237647
commit
c6d500eeb6
10
Scripts/list-fibonacci.ps1
Normal file
10
Scripts/list-fibonacci.ps1
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
function fibonacci($n) {
|
||||||
|
if ($n -lt 2) { return 1 }
|
||||||
|
return (fibonacci($n - 1)) + (fibonacci($n - 2))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($i in 0..100) {
|
||||||
|
Write-Host "$(fibonacci $i), " -noNewline
|
||||||
|
}
|
||||||
|
exit 0 # success
|
Loading…
Reference in New Issue
Block a user