rendered paste bodyprivate void btnCalculate_Click(object sender, EventArgs e)
{
int years = Convert.ToInt32(txtNumberOfYears.Text);
int months = years * 12;
decimal monthlyInvestment = Convert.ToDecimal(txtMonthlyInvestment.Text);
decimal yearlyInterestRate = Convert.ToDecimal(txtYearlyInterestRate.Text);
decimal monthlyInterestRate = yearlyInterestRate / 12 / 100;
decimal futureValue = 0m;
for (int i = 0; i < months; i++)
{
futureValue = (futureValue + monthlyInvestment) * (1 + monthlyInvestment);
}
txtFutureValue.Text = futureValue.ToString("c");
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}