Guest User

Untitled

a guest
Mar 1st, 2017
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. /**
  4.  * Created by Martin on 22.02.2017.
  5.  */
  6. public class Ex06Battles {
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in);
  9.  
  10.         int pokemonsPlayer1 = Integer.parseInt(scanner.nextLine());
  11.         int pokemonsPlayer2 = Integer.parseInt(scanner.nextLine());
  12.         int maxBattles = Integer.parseInt(scanner.nextLine());
  13.  
  14.         int counterBattles = 0;
  15.  
  16.         for (int i = 1; i <= pokemonsPlayer1; i++) {
  17.             if (counterBattles < maxBattles) {
  18.                 for (int j = 1; j <= pokemonsPlayer2; j++) {
  19.                     if (counterBattles < maxBattles) {
  20.                         counterBattles++;
  21.                         System.out.printf("(%d <-> %d) ", i, j);
  22.                     }
  23.                 }
  24.             } else {
  25.                 break;
  26.             }
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment