/**
 * This function takes a matrix, number of rows and number of columns as input
 * and counts the number of elements that are divisible by either 2 or 3.
 *
 * @param matrix The matrix to be checked (2D array)
 * @param rows Number of rows in the matrix
 * @param columns Number of columns in the matrix
 * @return The count of elements that are divisible by either 2 or 3
 */
fun checkAndCount(matrix: Array<IntArray>, rows: Int, columns: Int): Int {

    var count = 0

    // Nested loop to iterate over rows and columns
    for (i in 0 until rows) {
        for (j in 0 until columns) {
            // Check if element is divisible by 2 or 3 using OR operator
            if (matrix[i][j] % 2 == 0 || matrix[i][j] % 3 == 0) {
                count++
            }
        }
    }

    return count
}
/**
 * This function takes a matrix, number of rows and number of columns as input
 * and counts the number of elements that are divisible by either 2 or 3.
 *
 * @param matrix The matrix to be checked (2D array)
 * @param rows Number of rows in the matrix
 * @param columns Number of columns in the matrix
 * @return The count of elements that are divisible by either 2 or 3
 */
fun checkAndCount(matrix: Array<IntArray>, rows: Int, columns: Int): Int {
/**
 * This function takes a matrix, number of rows and number of columns as input
 * and counts the number of elements that are divisible by either 2 or 3.
 *
 * @param matrix The matrix to be checked (2D array)
 * @param rows Number of rows in the matrix
 * @param columns Number of columns in the matrix
 * @return The count of elements that are divisible by either 2 or 3
 */
fun checkAndCount(matrix: Array<IntArray>, rows: Int, columns: Int): Int {

    var count = 0

    // Nested loop to iterate over rows and columns
    for (i in 0 until rows) {
        for (j in 0 until columns) {
            // Check if element is divisible by 2 or 3 using OR operator
            if (matrix[i][j] % 2 == 0 || matrix[i][j] % 3 == 0) {
                count++
            }
        }
    }

    return count
}