Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
13
Task/Fibonacci-sequence/C-sharp/fibonacci-sequence-3.cs
Normal file
13
Task/Fibonacci-sequence/C-sharp/fibonacci-sequence-3.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
public static ulong Fib(uint x) {
|
||||
if (x == 0) return 0;
|
||||
|
||||
ulong prev = 0;
|
||||
ulong next = 1;
|
||||
for (int i = 1; i < x; i++)
|
||||
{
|
||||
ulong sum = prev + next;
|
||||
prev = next;
|
||||
next = sum;
|
||||
}
|
||||
return next;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue