JuliaPetkova

Untitled

May 28th, 2017
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 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 _2_6_11._5_Different_Numbers
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int a = int.Parse(Console.ReadLine());
  14. int b = int.Parse(Console.ReadLine());
  15.  
  16. int counter = 0;
  17.  
  18. for (int num1 = a; num1 <= b; num1++)
  19. {
  20. for (int num2 = a; num2 <= b; num2++)
  21. {
  22. for (int num3 = a; num3 <= b; num3++)
  23. {
  24. for (int num4 = a; num4 <= b; num4++)
  25. {
  26. for (int num5 = a; num5 <= b; num5++)
  27. {
  28. bool condition = ((a <= num1) && (num1 < num2) && (num2 < num3) && (num3 < num4) && (num4 < num5) && (num5 <= b));
  29. if (condition == true)
  30. {
  31. Console.WriteLine($"{num1} {num2} {num3} {num4} {num5}");
  32. counter++;
  33. }
  34. }
  35. }
  36. }
  37. }
  38. }
  39. if (counter == 0)
  40. {
  41. Console.WriteLine("No");
  42. }
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment