/**
 * This function takes a list of numbers and a modulus as input.
 * It appends new elements to the list based on the current elements' modulus with the given modulus.
 *
 * @param numbersList A list of numbers.
 * @param modulus The modulus with which the current elements will be compared.
 * @return Updated list after appending new elements based on modulus.
 *
 * Example:
 * val numbersList = mutableListOf(1, 2, 3, 4, 5)
 * val modulus = 2
 *
 * Output:
 * [1, 2, 3, 4, 5, 0, 2, 4]
 */
fun appendModulus(numbersList: MutableList<Int>, modulus: Int): List<Int> {

    for (number in numbersList.toList()) {
        val remainder = number % modulus
        numbersList.add(remainder)
    }
    return numbersList
}
/**
 * This function takes a list of numbers and a modulus as input.
 * It appends new elements to the list based on the current elements' modulus with the given modulus.
 *
 * @param numbersList A list of numbers.
 * @param modulus The modulus with which the current elements will be compared.
 * @return Updated list after appending new elements based on modulus.
 *
 * Example:
 * val numbersList = mutableListOf(1, 2, 3, 4, 5)
 * val modulus = 2
 *
 * Output:
 * [1, 2, 3, 4, 5, 0, 2, 4]
 */
fun appendModulus(numbersList: MutableList<Int>, modulus: Int): List<Int> {
/**
 * This function takes a list of numbers and a modulus as input.
 * It appends new elements to the list based on the current elements' modulus with the given modulus.
 *
 * @param numbersList A list of numbers.
 * @param modulus The modulus with which the current elements will be compared.
 * @return Updated list after appending new elements based on modulus.
 *
 * Example:
 * val numbersList = mutableListOf(1, 2, 3, 4, 5)
 * val modulus = 2
 *
 * Output:
 * [1, 2, 3, 4, 5, 0, 2, 4]
 */
fun appendModulus(numbersList: MutableList<Int>, modulus: Int): List<Int> {

    for (number in numbersList.toList()) {
        val remainder = number % modulus
        numbersList.add(remainder)
    }
    return numbersList
}