Advertisement
Terziyski

Problem 15. * Neighbour Wars

May 28th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.50 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 NeighbourWars
  8. {
  9.     class NeighbourWars
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int peshoDamage = int.Parse(Console.ReadLine());
  14.             int goshoDamage = int.Parse(Console.ReadLine());
  15.  
  16.             int peshoHealth = 100;
  17.             int goshoHealth = 100;
  18.  
  19.  
  20.             int round = 0;
  21.  
  22.             while (peshoHealth > 0 && goshoHealth > 0)
  23.             {
  24.  
  25.  
  26.                 if (round % 2 == 0)
  27.                 {
  28.  
  29.                     goshoHealth -= peshoDamage;
  30.                     Console.WriteLine($"Pesho used Roundhouse kick and reduced Gosho to {goshoHealth} health.");
  31.                 }
  32.                 if (round % 2 != 0)
  33.                 {
  34.  
  35.                     peshoHealth -= goshoDamage;
  36.                     Console.WriteLine($"Gosho used Thunderous fist and reduced Pesho to {peshoHealth} health.");
  37.  
  38.                 }
  39.                 round++;
  40.  
  41.                 if (round % 3 == 0)
  42.                 {
  43.                     goshoHealth += 10;
  44.                     peshoHealth += 10;
  45.                 }
  46.  
  47.             }
  48.             Console.WriteLine();
  49.             if (peshoHealth <= 0)
  50.             {
  51.                 Console.WriteLine($"Gosho won in {round}th round.");
  52.  
  53.             }
  54.             else
  55.             {
  56.                 Console.WriteLine($"Pesho won in {round}th round.");
  57.  
  58.             }
  59.         }
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement