Advertisement
Guest User

Untitled

a guest
Oct 10th, 2017
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. class Program
  8. {
  9. static void Main()
  10. {
  11. int e = int.Parse(Console.ReadLine());
  12. int number = int.Parse(Console.ReadLine());
  13. var primes = "";
  14.  
  15. {
  16. for (int i = e; i <= number; i++)
  17. {
  18. if (i == 0 || i == 1)
  19. {
  20. i = 2;
  21. }
  22.  
  23. bool isPrime = true;
  24. for (int j = 2; j <= Math.Sqrt(i); j++)
  25. {
  26. if (i % j == 0)
  27. {
  28. isPrime = false;
  29. break;
  30. }
  31. }
  32. if (isPrime)
  33. {
  34. primes = primes + i+ ", ";
  35. }
  36. }
  37. }
  38. primes = primes.Substring(0, primes.Length - 2);
  39. Console.WriteLine(primes);
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement