/**
 * This exercise requires appending elements to a list and applying the modulus operation.
 * The function takes a list of numbers and a multiplier as arguments. It appends each element
 * in the list multiplied by the multiplier after checking if the number is divisible by 2.
 *
 * @param numbers a list of numbers
 * @param multiplyBy an integer to multiply each number in the list by
 * @return A new list containing the multiplied elements that pass the modulus check.
 *
 * Example:
 * Given numbers = [1, 2, 3, 4, 5] and multiplyBy = 3, the function should return [6, 12]
 */
fun appendMultiplyElements(numbers: List<Int>, multiplyBy: Int): List<Int> {

    val multipliedElements = mutableListOf<Int>()

    // Iterate over each number in the list
    for (number in numbers) {
        // Check if the number is divisible by 2 using modulus
        if (number % 2 == 0) {
            // Multiply the number by the multiplier and append it to the new list
            multipliedElements.add(number * multiplyBy)
        }
    }

    return multipliedElements
}
/**
 * This exercise requires appending elements to a list and applying the modulus operation.
 * The function takes a list of numbers and a multiplier as arguments. It appends each element
 * in the list multiplied by the multiplier after checking if the number is divisible by 2.
 *
 * @param numbers a list of numbers
 * @param multiplyBy an integer to multiply each number in the list by
 * @return A new list containing the multiplied elements that pass the modulus check.
 *
 * Example:
 * Given numbers = [1, 2, 3, 4, 5] and multiplyBy = 3, the function should return [6, 12]
 */
fun appendMultiplyElements(numbers: List<Int>, multiplyBy: Int): List<Int> {
/**
 * This exercise requires appending elements to a list and applying the modulus operation.
 * The function takes a list of numbers and a multiplier as arguments. It appends each element
 * in the list multiplied by the multiplier after checking if the number is divisible by 2.
 *
 * @param numbers a list of numbers
 * @param multiplyBy an integer to multiply each number in the list by
 * @return A new list containing the multiplied elements that pass the modulus check.
 *
 * Example:
 * Given numbers = [1, 2, 3, 4, 5] and multiplyBy = 3, the function should return [6, 12]
 */
fun appendMultiplyElements(numbers: List<Int>, multiplyBy: Int): List<Int> {

    val multipliedElements = mutableListOf<Int>()

    // Iterate over each number in the list
    for (number in numbers) {
        // Check if the number is divisible by 2 using modulus
        if (number % 2 == 0) {
            // Multiply the number by the multiplier and append it to the new list
            multipliedElements.add(number * multiplyBy)
        }
    }

    return multipliedElements
}