NastySwipy

ConditionalStatementsLoops - 11. 5 Different Numbers

Apr 7th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.17 KB | None | 0 0
  1. using System;
  2. namespace _02b_ConditionalStatementsAndLoops_Exercises
  3. {
  4.     class ConditionalStatementsAndLoopsEx
  5.     {
  6.         static void Main(string[] args)
  7.         {
  8.             int num1 = int.Parse(Console.ReadLine());
  9.             int num2 = int.Parse(Console.ReadLine());
  10.             if (num1 + 5 >= num2)
  11.             {
  12.                 Console.WriteLine("No");
  13.                 return;
  14.             }
  15.             for (int i = num1; i <= num2 - 4; i++)
  16.             {
  17.                 for (int j = num1 + 1; j <= num2 - 3; j++)
  18.                 {
  19.                     for (int k = num1 + 2; k <= num2 - 2; k++)
  20.                     {
  21.                         for (int l = num1 + 3; l <= num2 - 1; l++)
  22.                         {
  23.                             for (int m = num1 + 4; m <= num2; m++)
  24.                             {
  25.                                 if (i < j && j < k && k < l && l < m)
  26.                                 {
  27.                                     Console.WriteLine($"{i} {j} {k} {l} {m}");
  28.                                 }
  29.                             }
  30.                         }
  31.                     }
  32.                 }
  33.             }
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment