You are on page 1of 2

1.

*
2. * C# Program to Generate Fibonacci Series
3. */
4. using System;
5. using System.Collections.Generic;
6. using System.Linq;
7. using System.Text;
8.
9. namespace fibonaci
10. {
11. class Program
12. {
13. static void Main(string[] args)
14. {
15. int i, count, f1 = 0, f2 = 1, f3 = 0;
16. Console.Write("Enter the Limit : ");
17. count = int.Parse(Console.ReadLine());
18. Console.WriteLine(f1);
19. Console.WriteLine(f2);
20. for (i = 0; i <= count; i++)
21. {
22. f3 = f1 + f2;
23. Console.WriteLine(f3);
24. f1 = f2;
25. f2 = f3;
26. }
27. Console.ReadLine();
28.
29. }
30. }
31. }
advertisements

Here is the output of the C# Program:


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

You might also like