September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
15
Task/Fibonacci-sequence/Bc/fibonacci-sequence.bc
Normal file
15
Task/Fibonacci-sequence/Bc/fibonacci-sequence.bc
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#! /usr/bin/bc -q
|
||||
|
||||
define fib(x) {
|
||||
if (x <= 0) return 0;
|
||||
if (x == 1) return 1;
|
||||
|
||||
a = 0;
|
||||
b = 1;
|
||||
for (i = 1; i < x; i++) {
|
||||
c = a+b; a = b; b = c;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
fib(1000)
|
||||
quit
|
||||
Loading…
Add table
Add a link
Reference in a new issue