假设今年的工业产值为100万元,产值增长率从键盘输入,请编程计算工业产值过多少年后可实现翻一番(即增加一倍)
#include<stdio.h>
int main()
{
double rate;
double total=1000000;
int count=0;
printf("Please input a increasing rate:\n");
scanf("%lf",&rate);
while(total<2000000)
{
total*=(1+rate);
count++;
}
printf("%d\n",count);
}