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