Home I'm trying to write a for loop but one of the values won't update. R
 This question already has an answer here: Why do R objects not print in a function or a “for” loop? 3 answers I'm just trying to write a simple for loops so I can see how much the person would owe after each consecutive year. It ends up printing the statement with only the n value ever changed. The A stays the same as the first time. for (n in 1:15){ A <- 5000 * (1+ .115/100) ^n sprintf("%.2f owed after %.f years", A, n) }  I have no clue what to do to fix it. Thanks