/**
 * A carpenter needs to calculate the number of cuts required for a given number of boards.
 * The carpenter must stop cutting if the number of cuts exceeds a specified maximum limit.
 * This exercise requires the use of loops in Kotlin.
 */
fun calculateCuts(numOfBoards: Int, maxCuts: Int): Int {

    var totalCuts = 0

    for (board in 1..numOfBoards) {
        // Calculate cuts for each board
        for (cut in 0 until board) {
            totalCuts++

            // Check if the total number of cuts exceeds the maximum limit
            if (totalCuts > maxCuts) {
                return totalCuts - 1  // Subtract one to exclude the current cut
            }
        }
    }

    return totalCuts
}
/**
 * A carpenter needs to calculate the number of cuts required for a given number of boards.
 * The carpenter must stop cutting if the number of cuts exceeds a specified maximum limit.
 * This exercise requires the use of loops in Kotlin.
 */
fun calculateCuts(numOfBoards: Int, maxCuts: Int): Int {
/**
 * A carpenter needs to calculate the number of cuts required for a given number of boards.
 * The carpenter must stop cutting if the number of cuts exceeds a specified maximum limit.
 * This exercise requires the use of loops in Kotlin.
 */
fun calculateCuts(numOfBoards: Int, maxCuts: Int): Int {

    var totalCuts = 0

    for (board in 1..numOfBoards) {
        // Calculate cuts for each board
        for (cut in 0 until board) {
            totalCuts++

            // Check if the total number of cuts exceeds the maximum limit
            if (totalCuts > maxCuts) {
                return totalCuts - 1  // Subtract one to exclude the current cut
            }
        }
    }

    return totalCuts
}