simonradev

PokemonBattles

Mar 11th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.10 KB | None | 0 0
  1. namespace PokemonBattles
  2. {
  3.     using System;
  4.  
  5.     public class PokemonBattles
  6.     {
  7.         public static void Main()
  8.         {
  9.             int firstPlayersPokemons = int.Parse(Console.ReadLine());
  10.             int secondPlayersPokemons = int.Parse(Console.ReadLine());
  11.             int totalBattles = int.Parse(Console.ReadLine());
  12.  
  13.             int battleCounter = 0;
  14.             bool tournamentFinished = false;
  15.             for (int firstPokemon = 1; firstPokemon <= firstPlayersPokemons; firstPokemon++)
  16.             {
  17.                 for (int secondPokemon = 1; secondPokemon <= secondPlayersPokemons; secondPokemon++)
  18.                 {
  19.                     Console.Write($"({firstPokemon} <-> {secondPokemon}) ");
  20.                     battleCounter++;
  21.  
  22.                     if (battleCounter == totalBattles)
  23.                     {
  24.                         tournamentFinished = true;
  25.                         break;
  26.                     }
  27.                 }
  28.  
  29.                 if (tournamentFinished)
  30.                 {
  31.                     break;
  32.                 }
  33.             }
  34.         }
  35.     }
  36. }
Add Comment
Please, Sign In to add comment