Advertisement
desislava_topuzakova

05. Beehive Defense

Jun 10th, 2020
967
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _05._Beehive_Defense
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int countBees = int.Parse(Console.ReadLine());
  10.             int health = int.Parse(Console.ReadLine());
  11.             int attack = int.Parse(Console.ReadLine());
  12.  
  13.             while (countBees >= 100)
  14.             {
  15.                 countBees -= attack;
  16.                 health -= countBees * 5;
  17.                 if (health <= 0)
  18.                 {
  19.                     Console.WriteLine($"Beehive won! Bees left {countBees}.");
  20.                     break;
  21.                 }
  22.             }
  23.             if (health > 0)
  24.             {
  25.                 if (countBees < 0)
  26.                 {
  27.                     countBees = 0;
  28.                 }
  29.                 Console.WriteLine($"The bear stole the honey! Bees left {countBees}.");
  30.             }
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement