int years = 0;
double rate, investment;
printf("원금 :");
scanf("%f", &investment);
printf("이율 :");
scanf("%f", &rate);
double total = investment;
while (total < investment * 2)
{
total = total * (1 + rate);
years += 1;
}
printf("%d년", years);
return 0;
왜 while 문 내에서 years 반복이 적용되서 출력이 안될까요?