Using Using Using Using Namespace: C# Program To Generate Fibonacci Series

Download as docx, pdf, or txt
Download as docx, pdf, or txt
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

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy