the fibonacci sequence is the first number, beginning with 1 and adding the previous number.
ie: 1 1 2 3 5 8 ...
1
1 + 1 = 2
1 + 2 = 3
2 + 3 = 5
3 + 5 = 8...
What is the fibonacci function in c programming?
long fib_num(long n)
{
long low(0), high(1);
while (n--) {
high += low;
low = high - low;
}
return low;
garland flower
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment