Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fibonacci Series
Message
De
20/07/2014 04:21:16
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Fibonacci Series
Versions des environnements
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01604182
Message ID:
01604182
Vues:
71
A long time ago I wrote an IEnumerable to create a Fibonacci series - but lost it. Now I came up with this:
static IEnumerable<double> FibonacciSeries(int count)
        {
            double x = 0;
            double y = 1;
            for (int i = 0; i < count/2; i++)
            {
                yield return x = x + y;
                yield return y = x + y;
            }
        }
but I've a feeling that the old, lost, version was more concise. Anyone see a way of improving the above ?
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform