예제 #1
0
        public static void PrintPrimeNumbers(int N, PrintIntMetod Print)
        {
            List <int> Primes = GetPrimeNumbers(N);

            foreach (int k in Primes)
            {
                Print(k);
            }
        }
예제 #2
0
        public static void PrintFibonachiRec(int a, int b, int N, PrintIntMetod Print)
        {
            int c = a + b;

            if (c <= N)
            {
                Print(c);
                PrintFibonachiRec(b, c, N, Print);
            }
        }
예제 #3
0
 public static void PrintFibonachiRec(int N, PrintIntMetod Print)
 {
     if (N >= 0)
     {
         Print(0);
     }
     if (N >= 1)
     {
         Print(1);
         PrintFibonachiRec(0, 1, N, Print);
     }
 }
예제 #4
0
 public static void PrintFibonachiIter(int N, PrintIntMetod Print)
 {
     if (N >= 0)
     {
         Print(0);
     }
     if (N >= 1)
     {
         Print(1);
         int a = 0, b = 1, c = 1;
         while (c <= N)
         {
             Print(c);
             a = b;
             b = c;
             c = a + b;
         }
     }
 }