0

Hi!

```
for (year = 1; year <= 15; year++)
{
cost = (interest_cost + monthly_instalment);
totalCost+=cost;
//after how many years the totalCost > price
if(totalCost>price)
printf(" %d ", year);
}
```

question:after how many years the totalCost > price?

my problem:

if the price is equal to 10 $ ;

and the cost is 3$ every year and after 4 years totalCost > price.

the program must print out 4.

But my program prints out 4, 5, 6,,,,,15.

How can I change it?