/**
 * Create a list of even numbers in the given range using a while loop and convert it into a tuple using the toTypedArray() function.
 * The start and end parameters specify the range within which to find the even numbers.
 *
 * @param start The starting number of the range (inclusive).
 * @param end The ending number of the range (inclusive).
 * @return A tuple containing all the even numbers found within the given range.
 * @throws IllegalArgumentException If the start parameter is greater than the end parameter.
 *
 * Example:
 * findEvenNumbers(1, 10) // (2, 4, 6, 8)
 * findEvenNumbers(10, 20) // (10, 12, 14, 16, 18)
 */
fun findEvenNumbers(start: Int, end: Int): List<Int> {

    if (start > end) {
        throw IllegalArgumentException("Start parameter cannot be greater than the end parameter.")
    }

    val numbers = mutableListOf<Int>()
    var current = start

    while (current <= end) {
        if (current % 2 == 0) {
            numbers.add(current)
        }
        current++
    }

    return numbers
}
/**
 * Create a list of even numbers in the given range using a while loop and convert it into a tuple using the toTypedArray() function.
 * The start and end parameters specify the range within which to find the even numbers.
 *
 * @param start The starting number of the range (inclusive).
 * @param end The ending number of the range (inclusive).
 * @return A tuple containing all the even numbers found within the given range.
 * @throws IllegalArgumentException If the start parameter is greater than the end parameter.
 *
 * Example:
 * findEvenNumbers(1, 10) // (2, 4, 6, 8)
 * findEvenNumbers(10, 20) // (10, 12, 14, 16, 18)
 */
fun findEvenNumbers(start: Int, end: Int): List<Int> {
/**
 * Create a list of even numbers in the given range using a while loop and convert it into a tuple using the toTypedArray() function.
 * The start and end parameters specify the range within which to find the even numbers.
 *
 * @param start The starting number of the range (inclusive).
 * @param end The ending number of the range (inclusive).
 * @return A tuple containing all the even numbers found within the given range.
 * @throws IllegalArgumentException If the start parameter is greater than the end parameter.
 *
 * Example:
 * findEvenNumbers(1, 10) // (2, 4, 6, 8)
 * findEvenNumbers(10, 20) // (10, 12, 14, 16, 18)
 */
fun findEvenNumbers(start: Int, end: Int): List<Int> {

    if (start > end) {
        throw IllegalArgumentException("Start parameter cannot be greater than the end parameter.")
    }

    val numbers = mutableListOf<Int>()
    var current = start

    while (current <= end) {
        if (current % 2 == 0) {
            numbers.add(current)
        }
        current++
    }

    return numbers
}