Advertisement
Fhernd

VT2.13-Generar-Numeros-Fibonacci.linq

Jan 29th, 2017
39,843
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.32 KB | None | 0 0
  1. List<ulong> numsFibonacci = new List<ulong>();
  2.  
  3. Enumerable.Range(0, 200)
  4.     .ToList()
  5.     .ForEach(
  6.         i =>
  7.         {
  8.             numsFibonacci.Add(i <= 1 ? 1 :
  9.                 numsFibonacci[i - 2] + numsFibonacci[i - 1]);
  10.         }
  11.     );
  12.    
  13. numsFibonacci.Take(15).Dump("Primeros 15 Números Fibonacci");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement