Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace exampreparation
- {
- class exam
- {
- static void Main(string[] args)
- {
- int population = int.Parse(Console.ReadLine());
- int years = int.Parse(Console.ReadLine());
- for (int i = 1; i <= years; i++)
- {
- int newBorn = population / 10 * 2;
- population += newBorn;
- if (i % 5 == 0 )
- {
- int migrated = population / 50 * 5;
- population -= migrated;
- }
- int dead = population / 20 * 2;
- population -= dead;
- }
- Console.WriteLine($"Beehive population: {population}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement