miroslavbstoyanov

Untitled

Mar 10th, 2018
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 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 _01.Birthday
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14.  
  15. int hundreds = int.Parse(Console.ReadLine());
  16. int tenths = int.Parse(Console.ReadLine());
  17. int units = int.Parse(Console.ReadLine());
  18.  
  19. for (int hundred = 1; hundred <= hundreds; hundred++)
  20. {
  21. for (int tent = 1; tent <= tenths; tent++)
  22. {
  23. for (int uni = 1; uni <= units; uni++)
  24. {
  25. bool isPrime = true;
  26.  
  27. if (tent == 1) isPrime = false;
  28. if (tent % 2 == 0) isPrime = false;
  29.  
  30. var boundary = (int)Math.Ceiling(Math.Sqrt(tent));
  31.  
  32. for (int i = 3; i <= boundary; i += 2)
  33. {
  34. if (tent % i == 0) isPrime = false;
  35. }
  36.  
  37. if (tent == 2) isPrime = true;
  38.  
  39.  
  40. if (hundred % 2 == 0 && uni % 2 == 0 && isPrime)
  41. {
  42. Console.WriteLine($"{hundred}{tent}{uni}");
  43.  
  44. }
  45. }
  46. }
  47. }
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment