/**
 * This exercise requires you to write a function that finds the common elements between two input lists
 * by using the modulus operation and iteration.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @return A list of common elements found in both input lists using the modulus operation for comparison.
 *
 * Example:
 * findCommonModuloElements(listOf(1, 2, 3, 4, 5), listOf(2, 4, 6, 8)) // [2, 4]
 */
fun findCommonModuloElements(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    // Iterate through each element in list1
    for (element in list1) {
        // Check if the element is common between list1 and list2 by using the modulus operation
        if (element in list2 && element !in commonElements) {
            commonElements.add(element)
        }
    }

    return commonElements
}
/**
 * This exercise requires you to write a function that finds the common elements between two input lists
 * by using the modulus operation and iteration.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @return A list of common elements found in both input lists using the modulus operation for comparison.
 *
 * Example:
 * findCommonModuloElements(listOf(1, 2, 3, 4, 5), listOf(2, 4, 6, 8)) // [2, 4]
 */
fun findCommonModuloElements(list1: List<Int>, list2: List<Int>): List<Int> {
/**
 * This exercise requires you to write a function that finds the common elements between two input lists
 * by using the modulus operation and iteration.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @return A list of common elements found in both input lists using the modulus operation for comparison.
 *
 * Example:
 * findCommonModuloElements(listOf(1, 2, 3, 4, 5), listOf(2, 4, 6, 8)) // [2, 4]
 */
fun findCommonModuloElements(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    // Iterate through each element in list1
    for (element in list1) {
        // Check if the element is common between list1 and list2 by using the modulus operation
        if (element in list2 && element !in commonElements) {
            commonElements.add(element)
        }
    }

    return commonElements
}