/**
 * This function calculates the growth of an investment over a specified number of years
 * with a given principal amount and interest rate.
 *
 * @param principal The initial amount invested.
 * @param interestRate The annual interest rate as a decimal.
 * @param numOfYears The number of years to calculate the investment growth.
 * @return The final amount of the investment after the specified number of years.
 */
fun calculateInvestmentGrowth(principal: Double, interestRate: Double, numOfYears: Int): Double {

    var principalAmount = principal
    var years = numOfYears

    while (years > 0) {
        principalAmount *= (1 + interestRate)
        years--
    }

    return principalAmount
}
/**
 * This function calculates the growth of an investment over a specified number of years
 * with a given principal amount and interest rate.
 *
 * @param principal The initial amount invested.
 * @param interestRate The annual interest rate as a decimal.
 * @param numOfYears The number of years to calculate the investment growth.
 * @return The final amount of the investment after the specified number of years.
 */
fun calculateInvestmentGrowth(principal: Double, interestRate: Double, numOfYears: Int): Double {
/**
 * This function calculates the growth of an investment over a specified number of years
 * with a given principal amount and interest rate.
 *
 * @param principal The initial amount invested.
 * @param interestRate The annual interest rate as a decimal.
 * @param numOfYears The number of years to calculate the investment growth.
 * @return The final amount of the investment after the specified number of years.
 */
fun calculateInvestmentGrowth(principal: Double, interestRate: Double, numOfYears: Int): Double {

    var principalAmount = principal
    var years = numOfYears

    while (years > 0) {
        principalAmount *= (1 + interestRate)
        years--
    }

    return principalAmount
}