Advertisement
RGeorgiev97

Untitled

May 3rd, 2020
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class JavaBasics {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.         int population = Integer.parseInt(scan.nextLine());
  7.         int years = Integer.parseInt(scan.nextLine());
  8.         for (int i = 1; i <= years; i++) {
  9.             population += population / 10 * 2;
  10.             if (i % 5 == 0) {
  11.                 population -= population / 50 * 5;
  12.             }
  13.             population -= population / 20 * 2;
  14.         }
  15.         System.out.println("Beehive population: " + population);
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement