-
-
Notifications
You must be signed in to change notification settings - Fork 6
Fibonacci
The Fibonacci
class provides methods to generate Fibonacci sequences of different numeric types.
The Fibonacci class provides the following methods:
The Int method returns an array of Fibonacci numbers as integers.
public static int[] Int(int Count = 2);
Parameter | Description |
---|---|
Count | The number of Fibonacci numbers to generate. |
An array of Count Fibonacci numbers as integers.
The method may throw the following exceptions:
- System.ArgumentOutOfRangeException: if Count is less than 2 or greater than 47.
int[] fibonacciNumbers = Fibonacci.Int(10);
foreach (int number in fibonacciNumbers)
{
Console.Write(number + " ");
}
// Output: 0 1 1 2 3 5 8 13 21 34
The IntAsync method asynchronously returns an array of Fibonacci numbers as integers.
public static Task<int[]> IntAsync(int Count = 2);
Parameter | Description |
---|---|
Count | The number of Fibonacci numbers to generate. |
An awaitable task that returns an array of Count Fibonacci numbers as integers.
The method may throw the following exceptions:
- System.ArgumentOutOfRangeException: if Count is less than 2 or greater than 47.
int[] fibonacciNumbers = await Fibonacci.IntAsync(10);
foreach (int number in fibonacciNumbers)
{
Console.Write(number + " ");
}
// Output: 0 1 1 2 3 5 8 13 21 34
This method returns an array of long
type Fibonacci numbers up to the specified count. The count must be between 2 and 93, inclusive.
-
Count
(optional): The number of Fibonacci numbers to generate. Defaults to 2.
An array of long
type Fibonacci numbers.
Get the first 10 Fibonacci numbers:
long[] result = Skylark.Standard.Helper.Fibonacci.Long(10);
// result: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
This method is the asynchronous version of Long
method. It returns a task that generates an array of long
type Fibonacci numbers up to the specified count. The count must be between 2 and 93, inclusive.
-
Count
(optional): The number of Fibonacci numbers to generate. Defaults to 2.
A task that generates an array of long
type Fibonacci numbers.
Get the first 10 Fibonacci numbers asynchronously:
long[] result = await Skylark.Standard.Helper.Fibonacci.LongAsync(10);
// result: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
This method returns an array of decimal
type Fibonacci numbers up to the specified count. The count must be between 2 and 140, inclusive.
-
Count
(optional): The number of Fibonacci numbers to generate. Defaults to 2.
An array of decimal
type Fibonacci numbers.
Get the first 10 Fibonacci numbers:
decimal[] result = Skylark.Standard.Helper.Fibonacci.Decimal(10);
// result: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
This method is the asynchronous version of Decimal
method. It returns a task that generates an array of decimal
type Fibonacci numbers up to the specified count. The count must be between 2 and 140, inclusive.
-
Count
(optional): The number of Fibonacci numbers to generate. Defaults to 2.
A task that generates an array of decimal
type Fibonacci numbers.
Get the first 10 Fibonacci numbers asynchronously:
decimal[] result = await Skylark.Standard.Helper.Fibonacci.DecimalAsync(10);
Get the first 20 Fibonacci numbers synchronously:
long[] result = Skylark.Standard.Helper.Fibonacci.Long(20);
Get the first 30 Fibonacci numbers asynchronously:
int[] result = await Skylark.Standard.Helper.Fibonacci.IntAsync(30);
- Tax
- Url
- Web
- Ping
- Port
- Text
- Time
- Hash
- Word
- Color
- Speed
- Lottery
- Storage
- Browser
- Unicode
- Password
- JavaScript
- Cryptology
- Typography
- Temperature
- Compression
- Decompression
- Cascading Style Sheets
- JavaScript Object Notation
- Hypertext Markup Language
- Extensible Markup Language
- Extensible HyperText Markup Language