Skip to content

fibonacci

Vašek edited this page Feb 6, 2019 · 2 revisions

fibonacci

This function returns the number from the fibonacci's sequence on the given position

Syntax:

fibonacci(n)
Argument Description
int n Position in the fibonacci's sequence

Returns: int

Description:

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.

Example:

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

Clone this wiki locally