/**
 * Given a range of numbers, find the sum of all even numbers within that range using a while loop.
 *
 * @param start The starting number of the range (inclusive).
 * @param end The ending number of the range (inclusive).
 * @return The sum of all even numbers within the given range.
 *
 * Example:
 * sumEvenNumbers(1, 10) -> 30
 * sumEvenNumbers(10, 20) -> 90
 * sumEvenNumbers(5, 18) -> 98
 */
fun sumEvenNumbers(start: Int, end: Int): Int {

    var sumEven = 0
    var num = start

    while (num <= end) {
        if (num % 2 == 0) {
            sumEven += num
        }
        num++
    }

    return sumEven
}
/**
 * Given a range of numbers, find the sum of all even numbers within that range using a while loop.
 *
 * @param start The starting number of the range (inclusive).
 * @param end The ending number of the range (inclusive).
 * @return The sum of all even numbers within the given range.
 *
 * Example:
 * sumEvenNumbers(1, 10) -> 30
 * sumEvenNumbers(10, 20) -> 90
 * sumEvenNumbers(5, 18) -> 98
 */
fun sumEvenNumbers(start: Int, end: Int): Int {
/**
 * Given a range of numbers, find the sum of all even numbers within that range using a while loop.
 *
 * @param start The starting number of the range (inclusive).
 * @param end The ending number of the range (inclusive).
 * @return The sum of all even numbers within the given range.
 *
 * Example:
 * sumEvenNumbers(1, 10) -> 30
 * sumEvenNumbers(10, 20) -> 90
 * sumEvenNumbers(5, 18) -> 98
 */
fun sumEvenNumbers(start: Int, end: Int): Int {

    var sumEven = 0
    var num = start

    while (num <= end) {
        if (num % 2 == 0) {
            sumEven += num
        }
        num++
    }

    return sumEven
}