int _tmain(int argc, _TCHAR* argv[])
{
float OldGNP,NewGNP,TempGNP,GNP1,GNP2;
int year=0;
printf("Please Input Current year GNP:");
scanf("%f",&OldGNP);
NewGNP=OldGNP;
TempGNP=OldGNP;
while (NewGNP<OldGNP*2) {
NewGNP=1.06*TempGNP;
TempGNP=NewGNP;
year++;
}
printf("double total after %d year\n",year);
printf("Please Input year you want:");
scanf("%d",&year);
GNP2=OldGNP;
while(year) {
GNP1=1.06*GNP2;
GNP2=GNP1;
year--;
}
printf("GNP :%f",GNP1/OldGNP);
return 0;
}
{
float OldGNP,NewGNP,TempGNP,GNP1,GNP2;
int year=0;
printf("Please Input Current year GNP:");
scanf("%f",&OldGNP);
NewGNP=OldGNP;
TempGNP=OldGNP;
while (NewGNP<OldGNP*2) {
NewGNP=1.06*TempGNP;
TempGNP=NewGNP;
year++;
}
printf("double total after %d year\n",year);
printf("Please Input year you want:");
scanf("%d",&year);
GNP2=OldGNP;
while(year) {
GNP1=1.06*GNP2;
GNP2=GNP1;
year--;
}
printf("GNP :%f",GNP1/OldGNP);
return 0;
}