static void Main(string[] args)
        {
            Console.Write("Please enter the number of values to be generated: ");
            int values    = Convert.ToInt32(Console.ReadLine());
            var fibonacci = new FibonacciSequence(values);

            foreach (var value in fibonacci)
            {
                Console.WriteLine(value);
            }

            Console.Read();
        }
Example #2
0
        static void Main(string[] args)
        {
            var numberOfValues = new Random().Next(5, 50);

            Console.WriteLine("Generating a Fibonacci sequence with {0} itens.", numberOfValues);

            var sequence = new FibonacciSequence(numberOfValues);

            var enumerator = sequence.GetEnumerator();

            while (enumerator.MoveNext())
            {
                Console.WriteLine(enumerator.Current);
            }

            Console.ReadKey();
        }