#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
int years;
double rate, investment;
printf("원금 :");
scanf("%f", &investment);
printf("이율 :");
scanf("%f", &rate);
double total = investment;
for (years = 1;total = investment * 2;years++)
{
total = total * (1 + rate);
printf("%d년", years);
}
return 0;
}
왜 for문 탈출이 안되는 거지
years 출력 밖으로 빼면 아예 안떠버리고
반복조건
문제가 2배일 때인데.. 그럼 반복조건 어케해야 되지