Following program generates the Fibonacci series up to 200.
using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int number1, number2; number1 = 0; number2 = 1; Console.WriteLine("{0}", number1); while (number2 < 200) { Console.WriteLine("{0}", number2); number2 = number2 + number1; number1 = number2 - number1; } Console.ReadLine(); } } }
Output
Fibonacci Series |
No comments:
Post a Comment