Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int winCounter = 0;
- int lostCounter = 0;
- int drawCounter = 0;
- for (int i = 1; i <= 3; i++) {
- String game = scanner.nextLine();
- char firstResult = game.charAt(0);
- char secondResult = game.charAt(2);
- if (firstResult > secondResult) {
- winCounter++;
- } else if (firstResult < secondResult) {
- lostCounter++;
- } else {
- drawCounter++;
- }
- }
- System.out.printf("Team won %d games.%n", winCounter);
- System.out.printf("Team lost %d games.%n", lostCounter);
- System.out.printf("Drawn games: %d%n", drawCounter);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement