Advertisement
dradoslavov89

Untitled

Jul 11th, 2018
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 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. namespace _06_Sixth
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var firstPair = int.Parse(Console.ReadLine());
  14. var secondPair = int.Parse(Console.ReadLine());
  15. var firstDiff = int.Parse(Console.ReadLine());
  16. var secondDiff = int.Parse(Console.ReadLine());
  17.  
  18. for (int first = firstPair; first <= firstPair+firstDiff; first++)
  19. {
  20. for (int second =secondPair; second < secondPair+secondDiff; second++)
  21. {
  22. double firstSqrt = (int)Math.Floor(Math.Sqrt(first));
  23. double secondSqrt = (int)Math.Floor(Math.Sqrt(second));
  24. bool isPrime1 = true;
  25. bool isPrime2 = true;
  26.  
  27. for (int first1 = 2; first1 <= firstSqrt; first1++)
  28. {
  29. if (firstSqrt%first1==0)
  30. {
  31. isPrime1 = false;
  32. }
  33. }
  34. for (int second2 = 2; second2 <= secondSqrt; second2++)
  35. {
  36. if (secondSqrt % second2 == 0)
  37. {
  38. isPrime2 = false;
  39. }
  40. }
  41. if (isPrime1 == true && isPrime2 == true)
  42. {
  43. Console.WriteLine($"{first}{second}");
  44. }
  45.  
  46. }
  47. }
  48.  
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement