Skip to content

Instantly share code, notes, and snippets.

@nickbauman
Last active August 2, 2024 16:25
Show Gist options
  • Save nickbauman/64c26acf4a6d8b71bc14021a9d000da4 to your computer and use it in GitHub Desktop.
Save nickbauman/64c26acf4a6d8b71bc14021a9d000da4 to your computer and use it in GitHub Desktop.
Future value of investment
package future_value
import "math"
func futureValue(investmentAmount, interestRate, inflationRate, years float64) (float64, float64) {
furtureValue := investmentAmount * math.Pow(1+interestRate/100, years)
futureRealValue := furtureValue / math.Pow(1+inflationRate/100, years)
return furtureValue, futureRealValue
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment