/**
 * The accountant needs to create a tuple using parentheses and perform a nested while loop.
 * The task is to create a tuple with the sum of each pair of numbers, obtained by iterating the two given numbers
 * until one of them is greater than the other. Additionally, a nested while loop should be used to print each number
 * in a decreasing order until reaching 0.
 *
 * @param num1 The first number of the pair.
 * @param num2 The second number of the pair.
 * @return A tuple containing the sum of each pair of numbers.
 */
fun createTupleAndNestedWhileLoop(num1: Int, num2: Int): List<Int> {

    // Ensure num1 is less than num2, if not swap them
    var number1 = num1
    var number2 = num2
    if (num1 > num2) {
        number1 = num2
        number2 = num1
    }

    val result = mutableListOf<Int>()
    var i = 0

    // Iterate until one number becomes greater than the other
    while (number1 <= number2) {
        var j = 0

        // Nested while loop to print each number in decreasing order until 0
        while (j <= number1) {
            println(number1)
            j++
            number1--
        }

        result.add(num1 + num2)
        i++
    }

    return result
}
/**
 * The accountant needs to create a tuple using parentheses and perform a nested while loop.
 * The task is to create a tuple with the sum of each pair of numbers, obtained by iterating the two given numbers
 * until one of them is greater than the other. Additionally, a nested while loop should be used to print each number
 * in a decreasing order until reaching 0.
 *
 * @param num1 The first number of the pair.
 * @param num2 The second number of the pair.
 * @return A tuple containing the sum of each pair of numbers.
 */
fun createTupleAndNestedWhileLoop(num1: Int, num2: Int): List<Int> {
/**
 * The accountant needs to create a tuple using parentheses and perform a nested while loop.
 * The task is to create a tuple with the sum of each pair of numbers, obtained by iterating the two given numbers
 * until one of them is greater than the other. Additionally, a nested while loop should be used to print each number
 * in a decreasing order until reaching 0.
 *
 * @param num1 The first number of the pair.
 * @param num2 The second number of the pair.
 * @return A tuple containing the sum of each pair of numbers.
 */
fun createTupleAndNestedWhileLoop(num1: Int, num2: Int): List<Int> {

    // Ensure num1 is less than num2, if not swap them
    var number1 = num1
    var number2 = num2
    if (num1 > num2) {
        number1 = num2
        number2 = num1
    }

    val result = mutableListOf<Int>()
    var i = 0

    // Iterate until one number becomes greater than the other
    while (number1 <= number2) {
        var j = 0

        // Nested while loop to print each number in decreasing order until 0
        while (j <= number1) {
            println(number1)
            j++
            number1--
        }

        result.add(num1 + num2)
        i++
    }

    return result
}