예제 #1
0
        public void CanIGetZeroWhenNoCorrect2()
        {
            int            d        = 25;
            int            g        = 15;
            int            expected = 0;
            PrimaryNumbers pn       = new PrimaryNumbers();
            int            actual   = pn.CountPrimaryNumbers(d, g);

            Assert.AreEqual(expected, actual);
        }
예제 #2
0
        public void CanICountPrimaryNumbersInScope()
        {
            int            d        = 2;
            int            g        = 15;
            int            expected = 6;
            PrimaryNumbers pn       = new PrimaryNumbers();
            int            actual   = pn.CountPrimaryNumbers(d, g);

            Assert.AreEqual(expected, actual);
        }
예제 #3
0
        static void Main(string[] args)
        {
            Console.Write("Podaj gorny zakres liczb: ");

            int            limit  = Convert.ToInt32(Console.ReadLine());
            PrimaryNumbers pn     = new PrimaryNumbers();
            var            liczby = pn.GetAllToLimit(limit);

            foreach (var liczba in liczby)
            {
                Console.Write(liczba + " ");
            }
            Console.Write("\nPodaj dolny zakres: ");
            int d = Convert.ToInt32(Console.ReadLine());

            Console.
            WriteLine("Ilosc liczb pierwszych w przedziale {0} {1} to {2} ",
                      d, limit, pn.CountPrimaryNumbers(d, limit));
            Console.ReadKey();
        }