Skip to content

Commit

Permalink
[alan] Fix and strengthen fibonacci
Browse files Browse the repository at this point in the history
  • Loading branch information
kostis committed Aug 30, 2024
1 parent f1120e0 commit 1b1e2d5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions alan/programs/fibonacci.alan
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ main(): proc
else
return fibonacci(n - 1) + fibonacci(n - 2);
}
n: int;
result: int;
{
writeString("Enter a number: ");
result = fibonacci(readInteger());
writeString("Fibonacci: ");
n = readInteger();
result = fibonacci(n);
writeString("Fibonacci of "); writeInteger(n); writeString(" is ");
writeInteger(result);
writeString("\n");
}
2 changes: 1 addition & 1 deletion alan/programs/fibonacci.input
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12
42
2 changes: 1 addition & 1 deletion alan/programs/fibonacci.result
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Enter a number: Fibonacci: 6765
Fibonacci of 42 is 267914296

0 comments on commit 1b1e2d5

Please sign in to comment.