用do while循环写人口增长预测据2010年统计我国人口1370536875人如果人口的年增长率为1请计算到哪一年中国总人口超过15亿的C语言程序
#include <stdio.h>
int main() {
long long population = 1370536875;
int year = 2010;
do {
population += population * 0.01;
year++;
} while (population < 1500000000);
printf("The total population of China will exceed 1.5 billion in %d.\n", year);
return 0;
}
运行结果:
The total population of China will exceed 1.5 billion in 2023.
原文地址: https://www.cveoy.top/t/topic/LaL 著作权归作者所有。请勿转载和采集!