Understanding Fibonacci Series C# – Expression & Code

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest

For programmers and developers, Fibonacci series is a common term that everyone learns with basics. To recall, Fibonacci series C# is a series of numbers wherein every number is a sum of the previous two. Starting with 0 and 1, the sequence is as 0, 1, 1, 2, 3, 5, 8, and so on.

General Expression and Program for Fibonacci Series C#

Written as a rule, the expression of Fibonacci series is Xn = Xn-1 + Xn-2. For clarification, below given is a program for the Fibonacci series C#.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace FibonaciDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            int i, count, f1 = 0, f2 = 1, f3 = 0;
            Console.Write("Enter the Limit : ");
            count = int.Parse(Console.ReadLine());
            Console.WriteLine(f1);
            Console.WriteLine(f2);
            for (i = 0; i <= count; i++)
            {
                f3 = f1 + f2;
                Console.WriteLine(f3);
                f1 = f2;
                f2 = f3;
            }
            Console.ReadLine();
 
        }
    }
}

 

Did you face any difficulty understanding the Fibonacci series C#, its expression, and code?  Share your comments and concerns in the below comment section.

[yikes-mailchimp form=”1″]

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on whatsapp
Share on email
Author Bio

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recommended for you
Connect With Us
Stay Connected

Subscribe to our newsletter today to receive updates on latest tech news, tutorials SEO tips many more.

Latest Articles
18518157_223940698108354_7866972342651071979_o
Apps

5 Best Apps for self-development

We live in a world of high dynamicity, progress, and constant change. But in most times it has been observed that we are not that welcoming when it comes to changing ourselves or changing anything around us. We try to repel change as long as possible.

Free hub for guest blogging nerds and newbie writers

  • Submit Guest Post
  • Share your Knowledge
  • Build your Backlinks
  • Advertise your products
  • Make money by writing
Subscribe to our newsletter today to receive updates on latest tech news, tutorials SEO tips many more.