import java.util.Scanner; public class Population { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter the number of years:"); int year = input.nextInt(); double second = 24*60*60; double born = second/7.0;//每天出生人口 double death = second/13.0;//每天死亡人口 double immigrant = second/45.0;//每天移民人口 double people = born - death + immigrant;//每天增加人口 double peopleYear = people * 365;//每年增加人口 double peopleNow = 312032486; double a = peopleNow+year*peopleYear; System.out.println("The population in " + year + "is " + a); } }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)