nicolepavlova386

06.Battles

Nov 26th, 2016
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 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 ConsoleApplication1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int firstPlayer = int.Parse(Console.ReadLine());
  14.             int secondPlayer = int.Parse(Console.ReadLine());
  15.             int maxBattles = int.Parse(Console.ReadLine());
  16.  
  17.             int counter = 0;
  18.             for (int i = 1; i <= firstPlayer; i++)
  19.             {
  20.                 for (int j = 1; j <= secondPlayer; j++)
  21.                 {
  22.                     counter++;
  23.                     if (counter > maxBattles)
  24.                     {
  25.                         break;
  26.                     }
  27.                     Console.Write("({0} <-> {1}) ", i, j);
  28.                 }
  29.             }
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment