interpreter project
This commit is contained in:
1 parent
6692c9c4ee
commit
afb55494e5
6 files changed
+850
No files matched your search
@@ -0,0 +1,27 @@
|
||||
# Fibonacci sequence
|
||||
func fun{
|
||||
if(x <= 2){
|
||||
return(1);
|
||||
}
|
||||
y = 0;
|
||||
x = x - 1;
|
||||
y = fun(x);
|
||||
x = x - 1;
|
||||
return(y + fun(x));
|
||||
};
|
||||
|
||||
# save the Fibonacci sequence of 1 to 15 in an array
|
||||
array arr(15);
|
||||
x = 0;
|
||||
while(x<15){
|
||||
arr[x] = fun(x) + 1000;
|
||||
x = x + 1;
|
||||
}
|
||||
|
||||
puts("Fibonacci sequence:");
|
||||
# print the Fibonacci sequence of 1 to 15
|
||||
i = 0;
|
||||
while(i < 15){
|
||||
print(arr[i]);
|
||||
i=i+1;
|
||||
}
|
||||
Reference in new issue
Block a user