mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-23 08:23:14 +01:00
Updated list-fibonacci.ps1
This commit is contained in:
parent
8a33a05610
commit
b6e703d96e
@ -12,13 +12,13 @@
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
function fibonacci($n) {
|
||||
function fibo([int]$n) {
|
||||
if ($n -lt 2) { return 1 }
|
||||
return (fibonacci($n - 1)) + (fibonacci($n - 2))
|
||||
return (fibo($n - 1)) + (fibo($n - 2))
|
||||
}
|
||||
|
||||
|
||||
foreach ($i in 0..100) {
|
||||
Write-Host "$(fibonacci $i), " -noNewline
|
||||
Write-Host "$(fibo $i), " -noNewline
|
||||
}
|
||||
exit 0 # success
|
||||
|
Loading…
Reference in New Issue
Block a user