# Fibonacci numbers in AWK

Example for versions
Jawk 1.02,
gawk 3.1.6,
mawk 1.3.3

This example uses iterative definition of Fibonacci numbers. `fib`

is an associative array, and `pr`

is a string.

```
BEGIN {
fib[1] = 1
fib[2] = 1
for (i=3; i<17; i++)
fib[i] = fib[i-1]+fib[i-2]
pr = ""
for (i=1; i<17; i++)
pr = pr fib[i] ", "
print pr "..."
}
```

## Comments

]]>blog comments powered by Disqus

]]>