Advertisement
Guest User

Fib

a guest
Mar 20th, 2014
3,199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Numerics;
  3.  
  4. namespace ConsoleInputOutput
  5. {
  6.     public static class Fibonachi
  7.     {
  8.         public static void Main()
  9.         {
  10.             int n = int.Parse(Console.ReadLine());
  11.         if(n==1) Console.WriteLine(0);
  12.             else
  13.             {
  14.             BigInteger first = 0;
  15.             BigInteger second = 1;
  16.             Console.WriteLine(first);
  17.             Console.WriteLine(second);
  18.             BigInteger third = 0;
  19.             for (int i = 2; i < n; i++)
  20.             {
  21.                 third = first + second;
  22.                 Console.Write(third + " ");
  23.                 first = second;
  24.                 second = third;
  25.             }
  26.             }
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement