Advertisement
YavorGrancharov

5_Different_Numbers

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