-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfibonacci-n-terms.y2k
26 lines (23 loc) · 1.01 KB
/
fibonacci-n-terms.y2k
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# fibonacci-n-terms.y2k
# This program reads an integer command line argument and prints the
# equivalent number of terms of the Fibonacci Sequence.
# Command line arguments are added to the end of the variable map,
# depending on the digit size of the parser (i.e. digit size 1 means
# CLI args are inserted at 9 and descending, digit size 2 means 99,
# etc).
8121 # Create variable 1 with type int (2) and size 1
0 # Insert 1 digit (0) into variable 1
8221 # Create variable 2 with type int (2) and size 1
1 # Insert 1 digit (1) into variable 2
8321 # Create variable 3 with type int (2) and size 1
0 # Insert 1 digit (0) into variable 3
# Init while loop (while var 9 > 0)
69311 # Create conditional using variable 9, with comparison ">" (3),
# as a loop (1), and with a right hand value size of 1
0 # Insert 1 digit (0) into conditional's right hand value
# Begin while loop
9211 # Print var 9
739111 # var 3 = var 1
719112 # var 1 = var 2
721113 # var 2 += var 3
792011 # var 9 -= 1