The Fibonacci Sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ......
The next number is found by adding up the two numbers before it.
The 2 is found by adding the two numbers before it (1+1).
using System;
namespace String
{
class Fibonacci
{
static void Main(string[] args)
{
int lim_low,lim_up;
int a = 0, b = 1, c;
Console.WriteLine("Enter First Value: ");
lim_low = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter Last Value: ");
lim_up = Convert.ToInt32(Console.ReadLine());
while (a<lim_up)
{
if (a > lim_low)
Console.WriteLine(a);
c = a + b;
a = b;
b = c;
}
Console.ReadLine();
}
}
}