WindFell

Substitute C#

Sep 11th, 2018
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.39 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     static void Main(string[] args)
  6.     {
  7.         int k = int.Parse(Console.ReadLine());
  8.         int l = int.Parse(Console.ReadLine());
  9.         int m = int.Parse(Console.ReadLine());
  10.         int n = int.Parse(Console.ReadLine());
  11.         int changeCount = 0;
  12.  
  13.         for (int first = k; first <= 8; first++)
  14.         {
  15.             for (int second = 9; second >= l; second--)
  16.             {
  17.                 for (int third = m; third <= 8; third++)
  18.                 {
  19.                     for (int fourth = 9; fourth >= n; fourth--)
  20.                     {
  21.                         if (first % 2 == 0 && second % 2 != 0 && third % 2 == 0 && fourth % 2 != 0)
  22.                         {
  23.                             if (first == third && second == fourth)
  24.                             {
  25.                                 Console.WriteLine("Cannot change the same player.");
  26.                             }
  27.                             else
  28.                             {
  29.                                 Console.WriteLine($"{first}{second} - {third}{fourth}");
  30.                                 changeCount++;
  31.                             }
  32.  
  33.                             if (changeCount >= 6)
  34.                             {
  35.                                 Environment.Exit(0);
  36.                             }
  37.                         }
  38.                     }
  39.                 }
  40.             }
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment