Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class BeehivePopulation_04 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int startPopulation = Integer.parseInt(scanner.nextLine());
- int years = Integer.parseInt(scanner.nextLine());
- for (int year = 1; year <= years; year++) {
- startPopulation += startPopulation / 10 * 2;
- if (year % 5 == 0) {
- startPopulation -= startPopulation / 50 * 5;
- }
- startPopulation -= startPopulation / 20 * 2;
- }
- System.out.printf("Beehive population: %d", startPopulation);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement