intf1=0,f2=1,f3=0;Console.WriteLine("———————————————————————————————————————————");Console.WriteLine("Program to print the Fibonacci series");Console.WriteLine("———————————————————————————————————————————");Console.Write("How many elements you want to print ");intn=Convert.ToInt32(Console.ReadLine());Console.WriteLine(f1);Console.WriteLine(f2);for(inti=2;i<n;i++){f3=f1+f2;Console.WriteLine(f3);f1=f2;f2=f3;}Console.WriteLine("———————————————————————————————————————————");
Output
kodingwindow@kw:~/csharp$ dotnet run
———————————————————————————————————————————
Program to print the Fibonacci series
———————————————————————————————————————————
How many elements you want to print 15
0
1
1
2
3
5
8
13
21
34
55
89
144
233
377
———————————————————————————————————————————
kodingwindow@kw:~/csharp$
Dear User, Thank you for visitng Kodingwindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.
Dear User, We are grateful for your interest in the Kodingwindow Android app. We intend to soon make it available on the Google Play Store. Currently, Android versions 10 and up require manual apk installations. Would you like to get the app?