Data update
This commit is contained in:
parent
ed705008a8
commit
0df55f9f24
2196 changed files with 32999 additions and 3075 deletions
|
|
@ -2,36 +2,35 @@ import extensions;
|
|||
|
||||
fib(n)
|
||||
{
|
||||
if (n < 0)
|
||||
{ InvalidArgumentException.raise() };
|
||||
if (n < 0)
|
||||
{ InvalidArgumentException.raise() };
|
||||
|
||||
^ (n)
|
||||
{
|
||||
if (n > 1)
|
||||
{
|
||||
^ this self(n - 2) + (this self(n - 1))
|
||||
}
|
||||
else
|
||||
{
|
||||
^ n
|
||||
}
|
||||
}(n)
|
||||
^ (n) {
|
||||
if (n > 1)
|
||||
{
|
||||
^ this self(n - 2) + (this self(n - 1))
|
||||
}
|
||||
else
|
||||
{
|
||||
^ n
|
||||
}
|
||||
}(n)
|
||||
}
|
||||
|
||||
public program()
|
||||
{
|
||||
for (int i := -1, i <= 10, i += 1)
|
||||
{
|
||||
console.print("fib(",i,")=");
|
||||
try
|
||||
{
|
||||
console.printLine(fib(i))
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
console.printLine:"invalid"
|
||||
}
|
||||
};
|
||||
for (int i := -1; i <= 10; i += 1)
|
||||
{
|
||||
console.print("fib(",i,")=");
|
||||
try
|
||||
{
|
||||
console.printLine(fib(i))
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
console.printLine("invalid")
|
||||
}
|
||||
};
|
||||
|
||||
console.readChar()
|
||||
console.readChar()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue