Algorithms_in_C 1.0.0
Set of algorithms implemented in C.
|
Finding Fibonacci number of any n
number using [Binet's closed form formula](https://en.wikipedia.org/wiki/Fibonacci_number#Binet's_formula) compute \(f_{nth}\) Fibonacci number using the binet's formula: Fn = 1√5 * (1+√5 / 2)^n+1 − 1√5 * (1−√5 / 2)^n+1.
More...
#include <math.h>
#include <stdio.h>
#include <assert.h>
Functions | |
int | fib (unsigned int n) |
for pow and sqrt for printf for assert | |
static void | test () |
Self-test implementations. | |
int | main () |
Main function. | |
Finding Fibonacci number of any n
number using [Binet's closed form formula](https://en.wikipedia.org/wiki/Fibonacci_number#Binet's_formula) compute \(f_{nth}\) Fibonacci number using the binet's formula: Fn = 1√5 * (1+√5 / 2)^n+1 − 1√5 * (1−√5 / 2)^n+1.
int fib | ( | unsigned int | n | ) |
for pow and sqrt for printf for assert
n | index of number in Fibonacci sequence |
int main | ( | void | ) |
Main function.
|
static |
Self-test implementations.