Advertisement
desislava_topuzakova

04. Beehive Population

Jun 10th, 2020
988
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _04._Beehive_Population
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int startPopulation = int.Parse(Console.ReadLine());
  10.             int years = int.Parse(Console.ReadLine());
  11.  
  12.             for (int year = 1; year <= years; year++)
  13.             {
  14.                 startPopulation += startPopulation / 10 * 2;
  15.                 if (year % 5 == 0)
  16.                 {
  17.                     startPopulation -= startPopulation / 50 * 5;
  18.                 }
  19.                 startPopulation -= startPopulation / 20 * 2;
  20.             }
  21.  
  22.             Console.WriteLine($"Beehive population: {startPopulation}");
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement