mirror of
https://github.com/sigmasternchen/fibonacci
synced 2025-03-15 08:08:58 +00:00
Fibonacci implemented in bc
This commit is contained in:
parent
6303f4ed47
commit
01be7b0ddc
1 changed files with 11 additions and 0 deletions
11
bc/fib.bc
Normal file
11
bc/fib.bc
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/bc
|
||||||
|
v1 = 1
|
||||||
|
v2 = 1
|
||||||
|
print 1, "\n", 1, "\n"
|
||||||
|
for(i = 0; i < 10; i++) {
|
||||||
|
v3 = v1 + v2
|
||||||
|
v1 = v2
|
||||||
|
v2 = v3
|
||||||
|
print v3, "\n"
|
||||||
|
}
|
||||||
|
quit
|
Loading…
Reference in a new issue