Advertisement
filipovv

5diffNums

May 31st, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | None | 0 0
  1. using System;
  2.  
  3. namespace DifferentNums
  4. {
  5.     class MainClass
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             int a = int.Parse(Console.ReadLine());
  10.             int b = int.Parse(Console.ReadLine());
  11.  
  12.             int counter = 0;
  13.  
  14.             for (int n1 = a; n1 <= b; n1++)
  15.             {
  16.                 for (int n2 = a; n2 <= b; n2++)
  17.                 {
  18.                     for (int n3 = a; n3 <= b; n3++)
  19.                     {
  20.                         for (int n4 = a; n4 <= b; n4++)
  21.                         {
  22.                             for (int n5 = a; n5 <= b; n5++)
  23.                             {
  24.                                 if (a<=n1&&n1<n2&&n2<n3&&n3<n4&&n4<n5&&n5<=b)
  25.                                 {
  26.                                     Console.WriteLine($"{n1} {n2} {n3} {n4} {n5}");
  27.                                     counter++;
  28.                                 }
  29.                             }
  30.                         }
  31.                     }
  32.                 }
  33.             }
  34.             if (counter == 0)
  35.             {
  36.                 Console.WriteLine("No");
  37.             }
  38.  
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement