Advertisement
Niicksana

Battles

Dec 10th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.92 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 _6.Battles
  8. {
  9.     class Battles
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             // Exam - 20 November 2016 - Morning
  14.             int firstPlayer = int.Parse(Console.ReadLine());
  15.             int secondPlayer = int.Parse(Console.ReadLine());
  16.             int maxBattles = int.Parse(Console.ReadLine());
  17.  
  18.             int count = 0;
  19.             for (int p1 = 1; p1 <= firstPlayer; p1++)
  20.             {
  21.                 for (int p2 = 1; p2 <= secondPlayer; p2++)
  22.                 {
  23.                     if (count == maxBattles)
  24.                     {
  25.                         break;
  26.                     }
  27.  
  28.                     Console.Write("({0} <-> {1}) ", p1, p2);
  29.                     count++;
  30.                 }
  31.             }
  32.             Console.WriteLine();
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement