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