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 peshosDamage = Integer.parseInt(scanner.nextLine());
- int goshosDamage = Integer.parseInt(scanner.nextLine());
- int peshosHealth = 100;
- int goshosHealth = 100;
- int round = 0;
- while (peshosHealth > 0 && goshosHealth > 0) {
- round++;
- if (round % 2 != 0) {
- goshosHealth -= peshosDamage;
- if (goshosHealth < 1) {
- System.out.printf("Pesho won in %dth round.", round);
- break;
- }
- System.out.printf("Pesho used Roundhouse kick and reduced Gosho to %d health.%n", goshosHealth);
- } else {
- peshosHealth -= goshosDamage;
- if (peshosHealth < 1) {
- System.out.printf("Gosho won in %dth round.", round);
- break;
- }
- System.out.printf("Gosho used Thunderous fist and reduced Pesho to %d health.%n", peshosHealth);
- }
- if (round % 3 == 0) {
- peshosHealth += 10;
- goshosHealth += 10;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement