Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///////////////////////////// ZAD 4 ///////////////////////////////////////
- //int i, j, dolnyZakres, górnyZakres, dokad;
- //int[] tablica = new int[10000];
- //do
- //{
- // Console.WriteLine("Podaj dolny zakres:");
- //} while (!int.TryParse(Console.ReadLine(), out dolnyZakres));
- //do
- //{
- // Console.WriteLine("Podaj górny zakres:");
- //} while (!int.TryParse(Console.ReadLine(), out górnyZakres));
- //dokad = (int)Math.Floor(Math.Sqrt(górnyZakres));
- ////inicjuj tablice
- //for (i = 1; i <= górnyZakres; i++) tablica[i] = i;
- ////algorytm - sito eratostenesa
- //for (i = 2; i <= dokad; i++)
- //{
- // if (tablica[i] != 0)
- // {
- // j = i + i;
- // while (j <= górnyZakres)
- // {
- // tablica[j] = 0;
- // j += i;
- // }
- // }
- //}
- ////wypisz wynik
- //Console.WriteLine("Liczby pierwsze z zakresu od "+dolnyZakres+" do " + górnyZakres);
- //for (i = dolnyZakres; i <= górnyZakres; i++)
- // if (tablica[i] != 0)
- // Console.Write(i + ", ");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement