Wednesday 3 January 2018

Fibonacci Series in C#(Sharp)

                  Fibonacci Series in C#(Sharp)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Fibonacciseries
{
   
    class Program
    {
        /* 
         * creating the fab() function.
         * we are storing the values in count for limit of the series.
        */
        static int count;
          void fab()
        {
            int i, f1 = 0, f2 = 1, f3 = 0;
            Console.WriteLine(f1);
            Console.WriteLine(f2);
            for (i = 0; i < count; i++)
            {
                f3 = f1 + f2;
                Console.WriteLine(f3);
                f1 = f2;
                f2 = f3;
            }
            Console.ReadLine();
         }
       
             static void Main(string[] args)
           {
            count = Convert.ToInt16(args[0]);
            Program p = new Program();
            p.fab();
           }
    }
}

No comments:

Post a Comment

😍Developer on Weekends #shorts #officememes #developermemes

😍Developer on Weekends #shorts #officememes #developermemes Welcome to the latest viral YouTube shorts meme for developers! 😍Developer on...