Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace EasterEggBattle
- {
- class Program
- {
- static void Main(string[] args)
- {
- int firstPlayer = int.Parse(Console.ReadLine());
- int secondPlayer = int.Parse(Console.ReadLine());
- string command = Console.ReadLine();
- while (command != "End")
- {
- if (command == "one")
- {
- secondPlayer--;
- if (secondPlayer == 0)
- {
- Console.WriteLine($"Player two is out of eggs. Player one has { firstPlayer} eggs left.");
- break;
- }
- }
- else if (command == "two")
- {
- firstPlayer--;
- if (firstPlayer == 0)
- {
- Console.WriteLine($"Player one is out of eggs. Player two has { secondPlayer} eggs left.");
- break;
- }
- }
- command = Console.ReadLine();
- }
- if (command == "End")
- {
- Console.WriteLine($"Player one has { firstPlayer} eggs left.");
- Console.WriteLine($"Player two has { secondPlayer} eggs left.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement