Search This Blog

Saturday, 7 September 2013

Fibanocci Series by C#

Determine Fibanocci Series

using System;

class FibnocciSeries
{
   public static void Main(String[] args)
   {
     int a=-1,b=1,c,i,limit;
     Console.WriteLine("Enter the limit of the series:");
     limit=Convert.ToInt32(Console.ReadLine());
     for(c=1;c<=limit;c++)
     {
        i=a+b;
        Console.Write(i+" ");
        a=b;
        b=i;
     }    
   }
}   
output:


No comments:

Popular Posts