-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfib.sqs
More file actions
55 lines (48 loc) · 1021 Bytes
/
Copy pathfib.sqs
File metadata and controls
55 lines (48 loc) · 1021 Bytes
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
ouch! fib
thisway! n == 0
woomy output 0
thisway@ end_of_fib
ngyes
thisway! n == 1
woomy output 1
thisway@ end_of_fib
ngyes
woomy grandparent 1
woomy parent 3
woomy iterator 2
oomy iterator < n
woomy current 3
woomy current * parent
woomy current - grandparent
woomy grandparent parent
woomy parent current
woomy iterator + 1
ngyes
woomy output current
help!woomy end_of_fib @CURRENT_LINE
ouch?
# Read input
splat! number
veemo# number input_length
booyah? 10
# Convert the character string into a value
woomy iterator 1
woomy sum 0
oomy iterator <= input_length
veemo current <- number [iterator]
woomy current - '0
woomy sum * 10
woomy sum + current
woomy iterator + 1
ngyes
# Iterate to sum times, printing each fibonacci number
woomy n 0
oomy n <= sum
ouch@ fib
booyah! n
booyah? ':
booyah? 32
booyah! output
booyah? 10
woomy n + 1
ngyes