skipter icon

C# Fundamentals - Neighbours Wars Hardcore

skipter | PRO | 06/04/17 07:37:28 PM UTC | 0 ⭐ | 321 👁️ | Never ⏰ | []
C# |

1.44 KB

|

None

|

0 👍

/

0 👎

using System;
class Program
{
    static void Main()
    {
        int peshosDamage = int.Parse(Console.ReadLine());
        int GoshosDamage = int.Parse(Console.ReadLine());
 
        int peshosHealth = 100;
        int goshosHealth = 100;
        int counter = 1;
 
        while (true)
        {
            if (counter % 2 == 1)
            {
                goshosHealth -= peshosDamage;
                if (goshosHealth > 0)
                {
                    Console.WriteLine($"Pesho used Roundhouse kick and reduced Gosho to {goshosHealth} health.");
                }
 
            }
            else if (counter % 2 == 0)
            {
                peshosHealth -= GoshosDamage;
                if (peshosHealth > 0)
                {
                    Console.WriteLine($"Gosho used Thunderous fist and reduced Pesho to {peshosHealth} health.");
                }
            }
            if (counter % 3 == 0 && peshosHealth > 0 && goshosHealth > 0)
            {
                goshosHealth += 10;
                peshosHealth += 10;
            }
            if (peshosHealth <= 0)
            {
                Console.WriteLine($"Gosho won in {counter}th round.");
                break;
            }
 
            else if (goshosHealth <= 0)
            {
                Console.WriteLine($"Pesho won in {counter}th round.");
                break;
            }
            counter++;
        }
    }
}

Comments