fabonicci series
// fabonicci series
Console.WriteLine("Enter a number to print fabonicci series till.");
int a = int.Parse(Console.ReadLine());
Console.WriteLine("fabonicci series till " + a + " is");
int b = 0;
int c = 1;
Console.WriteLine(b);
Console.WriteLine(c);
for (int d = b + c; d <= a; d = b + c)
{
Console.WriteLine(d);
b = c;
c = d;
}
Console.ReadLine();
No comments:
Post a Comment