/**
 * Given two dividends, this function finds the largest common dividend using division assignment operator and if-elif-else statements.
 *
 * @param dividend1 the first dividend (integer)
 * @param dividend2 the second dividend (integer)
 * @return The largest common dividend (integer) of dividend1 and dividend2.
 */
fun findCommonDividend(dividend1: Int, dividend2: Int): Int {

    if (dividend1 < 0 || dividend2 < 0) {
        return -1 // Assuming -1 represents an error for negative dividends
    }

    if (dividend1 == 0 || dividend2 == 0) {
        return -2 // Assuming -2 represents an error for zero dividends
    }

    // Determine the smaller and larger dividend
    val (smaller, larger) = if (dividend1 < dividend2) {
        Pair(dividend1, dividend2)
    } else {
        Pair(dividend2, dividend1)
    }

    // Find the largest common dividend using repeated subtraction
    var tempSmaller = smaller
    var tempLarger = larger
    while (tempLarger % tempSmaller != 0) {
        val remainder = tempLarger % tempSmaller
        tempLarger = tempSmaller
        tempSmaller = remainder
    }

    return tempSmaller
}
/**
 * Given two dividends, this function finds the largest common dividend using division assignment operator and if-elif-else statements.
 *
 * @param dividend1 the first dividend (integer)
 * @param dividend2 the second dividend (integer)
 * @return The largest common dividend (integer) of dividend1 and dividend2.
 */
fun findCommonDividend(dividend1: Int, dividend2: Int): Int {
/**
 * Given two dividends, this function finds the largest common dividend using division assignment operator and if-elif-else statements.
 *
 * @param dividend1 the first dividend (integer)
 * @param dividend2 the second dividend (integer)
 * @return The largest common dividend (integer) of dividend1 and dividend2.
 */
fun findCommonDividend(dividend1: Int, dividend2: Int): Int {

    if (dividend1 < 0 || dividend2 < 0) {
        return -1 // Assuming -1 represents an error for negative dividends
    }

    if (dividend1 == 0 || dividend2 == 0) {
        return -2 // Assuming -2 represents an error for zero dividends
    }

    // Determine the smaller and larger dividend
    val (smaller, larger) = if (dividend1 < dividend2) {
        Pair(dividend1, dividend2)
    } else {
        Pair(dividend2, dividend1)
    }

    // Find the largest common dividend using repeated subtraction
    var tempSmaller = smaller
    var tempLarger = larger
    while (tempLarger % tempSmaller != 0) {
        val remainder = tempLarger % tempSmaller
        tempLarger = tempSmaller
        tempSmaller = remainder
    }

    return tempSmaller
}