Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.37 KB | None | 0 0
  1. /////////////////////////////   ZAD 4   ///////////////////////////////////////
  2.             //int i, j, dolnyZakres, górnyZakres, dokad;
  3.             //int[] tablica = new int[10000];
  4.             //do
  5.             //{
  6.             //    Console.WriteLine("Podaj dolny zakres:");
  7.             //} while (!int.TryParse(Console.ReadLine(), out dolnyZakres));
  8.             //do
  9.             //{
  10.             //    Console.WriteLine("Podaj górny zakres:");
  11.             //} while (!int.TryParse(Console.ReadLine(), out górnyZakres));
  12.             //dokad = (int)Math.Floor(Math.Sqrt(górnyZakres));
  13.             ////inicjuj tablice
  14.             //for (i = 1; i <= górnyZakres; i++) tablica[i] = i;
  15.  
  16.             ////algorytm - sito eratostenesa
  17.             //for (i = 2; i <= dokad; i++)
  18.             //{
  19.             //    if (tablica[i] != 0)
  20.             //    {
  21.             //        j = i + i;
  22.             //        while (j <= górnyZakres)
  23.             //        {
  24.             //            tablica[j] = 0;
  25.             //            j += i;
  26.             //        }
  27.             //    }
  28.             //}
  29.  
  30.             ////wypisz wynik
  31.             //Console.WriteLine("Liczby pierwsze z zakresu od "+dolnyZakres+" do " + górnyZakres);
  32.             //for (i = dolnyZakres; i <= górnyZakres; i++)
  33.             //    if (tablica[i] != 0)
  34.             //        Console.Write(i + ", ");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement