Uyku tutmadığında saydığım koyunlardan sürü kursam..
using ConsoleDump; do{ Console.Write("Koyun sayısı:"); string koyun_sayisi = Console.ReadLine(); Console.Write("Doğum döngüsü sayısı:"); string dogum_sayisi = Console.ReadLine(); KacKoyun1(int.Parse(koyun_sayisi ?? "0")) .Take(int.Parse(dogum_sayisi ?? "0")) .Dump(); Console.WriteLine("----------------------------------"); } while(true); //1. Yöntem IEnumerable<int> KacKoyun1(int c){ int n=1; for(;;){ yield return c; n = c + (c=n); } } //2. Yöntem IEnumerable<int> KacKoyun2(int c){ int n = 1, r; for(;;) { yield return c; r = c + n; c = n; n = r; } }