C# Program to Print Fibonacci series

C# Program to Print Fibonacci series - welcome to our blog Techno Live, now we will discuss information about the C# Program to Print Fibonacci series, our admins on this blog has been around to collect information you are looking for so that we usakan to display complete information for you, and in this blog, you can also search for other information, ok please continue reading may be easily understood:

This is about : C# Program to Print Fibonacci series
And this article : C# Program to Print Fibonacci series
Article Csharp, Article programming, Article programs,

You can also see our article on:


C# Program to Print Fibonacci series

C# Program to Print Fibonacci series

Program Statement:
Write a program which prints the Fibonacci series using loop.
1 1 2 3 5 8 13 21 34 …

Solution:
 public class _fib
{
int f = 0, s = 1, n, fib = 0;
public void _show()
{
Console.WriteLine("\n\t\tPrint fibonacci series 0 1 1 2 3 5 8 13 ...\n\n");
Console.Write("\n\t\tEnter range of terms of fibonacci series : ");
n = Convert.ToInt32(Console.ReadLine());
Console.Write("\n\t\tFirst {0} terms are : ", n);
for (int x = 0; x < n; x++)
{
if (x <= 1)
{ fib = x; }
else
{
fib = f + s;
f = s;
s = fib;
}
Console.Write("{0} ", fib);
}
Console.WriteLine("\n");
}
}




Articles C# Program to Print Fibonacci series finished we discussed

A few of our information about the C# Program to Print Fibonacci series, I hope you can exploit carefully

No've You've finished reading an article on C# Program to Print Fibonacci series and many articles about modern home in our blog this, please read it. and url link of this article is https://liveeconcerts.blogspot.com/2013/12/c-program-to-print-fibonacci-series.html Hopefully discussion articles on provide more knowledge about the world of tech gadgets.

Tag : , , ,

0 Response to "C# Program to Print Fibonacci series"

Post a Comment