Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
24
Task/Fibonacci-sequence/BASIC256/fibonacci-sequence.basic
Normal file
24
Task/Fibonacci-sequence/BASIC256/fibonacci-sequence.basic
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# Basic-256 ver 1.1.4
|
||||
# iterative Fibonacci sequence
|
||||
# Matches sequence A000045 in the OEIS, https://oeis.org/A000045/list
|
||||
|
||||
# Return the Nth Fibonacci number
|
||||
|
||||
input "N = ",f
|
||||
limit = 500 # set upper limit - can be changed, removed
|
||||
f = int(f)
|
||||
if f > limit then f = limit
|
||||
a = 0 : b = 1 : c = 0 : n = 0 # initial values
|
||||
|
||||
|
||||
while n < f
|
||||
print n + chr(9) + c # chr(9) = tab
|
||||
a = b
|
||||
b = c
|
||||
c = a + b
|
||||
n += 1
|
||||
|
||||
end while
|
||||
|
||||
print " "
|
||||
print n + chr(9) + c
|
||||
Loading…
Add table
Add a link
Reference in a new issue