/**
 * Takes two arrays as input and multiplies corresponding elements of the arrays.
 * The result is stored in a new array named 'result'.
 *
 * @param arr1 First array (list) containing integers
 * @param arr2 Second array (list) containing integers
 * @return Resulting array (list) after multiplication
 *
 * Example:
 * val arr1 = intArrayOf(1, 2, 3, 4)
 * val arr2 = intArrayOf(5, 6, 7, 8)
 * multiplyArrays(arr1, arr2) -> [5, 12, 21, 32]
 */
fun multiplyArrays(arr1: IntArray, arr2: IntArray): IntArray {

    if (arr1.size != arr2.size) {
        // The arrays must have the same length for multiplication
        throw IllegalArgumentException("Arrays must have the same length!")
    }

    val result = IntArray(arr1.size)

    // Perform multiplication of corresponding elements and store in 'result' array
    for (i in arr1.indices) {
        result[i] = arr1[i] * arr2[i]
    }

    return result
}
/**
 * Takes two arrays as input and multiplies corresponding elements of the arrays.
 * The result is stored in a new array named 'result'.
 *
 * @param arr1 First array (list) containing integers
 * @param arr2 Second array (list) containing integers
 * @return Resulting array (list) after multiplication
 *
 * Example:
 * val arr1 = intArrayOf(1, 2, 3, 4)
 * val arr2 = intArrayOf(5, 6, 7, 8)
 * multiplyArrays(arr1, arr2) -> [5, 12, 21, 32]
 */
fun multiplyArrays(arr1: IntArray, arr2: IntArray): IntArray {
/**
 * Takes two arrays as input and multiplies corresponding elements of the arrays.
 * The result is stored in a new array named 'result'.
 *
 * @param arr1 First array (list) containing integers
 * @param arr2 Second array (list) containing integers
 * @return Resulting array (list) after multiplication
 *
 * Example:
 * val arr1 = intArrayOf(1, 2, 3, 4)
 * val arr2 = intArrayOf(5, 6, 7, 8)
 * multiplyArrays(arr1, arr2) -> [5, 12, 21, 32]
 */
fun multiplyArrays(arr1: IntArray, arr2: IntArray): IntArray {

    if (arr1.size != arr2.size) {
        // The arrays must have the same length for multiplication
        throw IllegalArgumentException("Arrays must have the same length!")
    }

    val result = IntArray(arr1.size)

    // Perform multiplication of corresponding elements and store in 'result' array
    for (i in arr1.indices) {
        result[i] = arr1[i] * arr2[i]
    }

    return result
}