Fibonacci Series Program in C#

Advertisements

Prev Tutorial Next Tutorial

Fibonacci Series Program in C#

Fibonacci Series add two previous term and get next term its first two terms are 0 and 1. Fibonacci series are; 0 1 1 2 3 5 8 13.....

Fibonacci Series Program in C#

using System;
 
namespace fibonaci
{
class Program
{
static void Main(string[] args)
{
int i, count, term1 = 0, term2 = 1, term3 = 0;
Console.Write("Enter the Limit: ");
count = int.Parse(Console.ReadLine());
Console.WriteLine(term1);
Console.WriteLine(term2);
for (i=0; i<=count; i++)
{
term3 = term1 + term2;
Console.WriteLine(term3);
term1 = term2;
term2 = term3;
}
Console.ReadLine();
}
}
}

Output

Enter the Limit: 34
0
1
1
2
3
5
8
13
21
34

Output

Enter the Limit: 13
0
1
1
2
3
5
8
13

Prev Tutorial Next Tutorial

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements