-
-
Notifications
You must be signed in to change notification settings - Fork 18
fibonacci
Vašek edited this page Feb 6, 2019
·
2 revisions
This function returns the number from the fibonacci's sequence on the given position
fibonacci(n)
Argument | Description |
---|---|
int n |
Position in the fibonacci's sequence |
Returns: int
Fibonacci's sequence is an infinite row of numbers. Each number is the sum of the two preceding ones, starting from 0 and 1. The beginning of the sequence is thus: 0, 1, 1, 2, 3, 5, 8, 13, 21,... This function returns a number on the given position.
int value = fibonacci(6);
0, 1, 1, 2, 3, 5, 8. This function will return the number in sequnce on the 6th position (counting from 0). So this function will set value
to 8.
Back to number_functions