Advertisement
mockingbird_ls

Fibonacci

Apr 16th, 2015
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Numerics;
  7.  
  8.  
  9.  
  10. namespace _10.Fibonacci
  11. {
  12.     class Fibonacci
  13.     {
  14.         static void Main()
  15.         {
  16.             Console.WriteLine("How many Fibonacci members do you want? ");
  17.             BigInteger Members = BigInteger.Parse(Console.ReadLine());
  18.            
  19.             BigInteger a = -1;
  20.             BigInteger b = 1;
  21.             BigInteger c = 0;
  22.  
  23.             for (BigInteger i = 0; i < Members; i++)
  24.             {
  25.                 c = a;
  26.                 a = b;
  27.                 b = a + c;
  28.                 Console.Write(b + " ");
  29.             }
  30.            
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement