September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
|
|
@ -1,26 +1,29 @@
|
|||
import extensions.
|
||||
import extensions;
|
||||
|
||||
fibu = (:i)
|
||||
[
|
||||
var ac := Array new(2); populate(:i)(i).
|
||||
if (i < 2)
|
||||
[ ^ ac[i] ];
|
||||
[
|
||||
2 to:i do(:i)
|
||||
[
|
||||
var t := ac[1].
|
||||
ac[1] := ac[0] + ac[1].
|
||||
ac[0] := t.
|
||||
].
|
||||
fibu(n)
|
||||
{
|
||||
int[] ac := new int[] { 0,1 };
|
||||
if (n < 2)
|
||||
{
|
||||
^ ac[n]
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i := 2, i <= n, i+=1)
|
||||
{
|
||||
int t := ac[1];
|
||||
ac[1] := ac[0] + ac[1];
|
||||
ac[0] := t
|
||||
};
|
||||
|
||||
^ ac[1]
|
||||
]
|
||||
].
|
||||
^ ac[1]
|
||||
}
|
||||
}
|
||||
|
||||
program =
|
||||
[
|
||||
0 to:10 do(:i)
|
||||
[
|
||||
console printLine(fibu(i)).
|
||||
]
|
||||
].
|
||||
public program()
|
||||
{
|
||||
for(int i := 0, i <= 10, i+=1)
|
||||
{
|
||||
console.printLine(fibu(i))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue