Advertisement
Guest User

06. Special Combinations

a guest
Jul 15th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _06.Special_Combinations
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int a = int.Parse(Console.ReadLine());
  10. int b = int.Parse(Console.ReadLine());
  11. int c = int.Parse(Console.ReadLine());
  12.  
  13. for (int i = 2; i <= a; i++)
  14. {
  15. for (int j = 2; j <= b; j++)
  16. {
  17. for (int k = 2; k <= c; k++)
  18. {
  19. if ((i % 2 == 0) && isPrime(j) && (k % 2 == 0)) {
  20. Console.WriteLine($"{i} {j} {k}");
  21. }
  22. }
  23. }
  24. }
  25. }
  26. static bool isPrime(int a) {
  27. bool isPrime = true;
  28. for (int i = a; i >= 1; i--)
  29. {
  30. if (i == a || i == 1)
  31. {
  32. continue;
  33. }
  34. else if (a % i == 0)
  35. {
  36. isPrime = false;
  37. break;
  38. }
  39. }
  40. return isPrime;
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement