/**
 * Given two sets, return the result of multiplying each element in set1 by each element in set2
 * and storing the results in a new set.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The set containing the multiplied elements.
 * @throws IllegalArgumentException If either set1 or set2 is not a set.
 *
 * Example:
 * multiplySet(setOf(1, 2, 3), setOf(4, 5)) -> setOf(4, 5, 8, 10, 12, 15)
 */
fun multiplySet(set1: Set<Int>, set2: Set<Int>): Set<Int> {

    if (set1 !is Set<*> || set2 !is Set<*>) {
        throw IllegalArgumentException("Both set1 and set2 must be sets")
    }

    val multipliedSet = mutableSetOf<Int>()

    for (element1 in set1) {
        for (element2 in set2) {
            multipliedSet.add(element1 * element2)
        }
    }

    return multipliedSet
}
/**
 * Given two sets, return the result of multiplying each element in set1 by each element in set2
 * and storing the results in a new set.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The set containing the multiplied elements.
 * @throws IllegalArgumentException If either set1 or set2 is not a set.
 *
 * Example:
 * multiplySet(setOf(1, 2, 3), setOf(4, 5)) -> setOf(4, 5, 8, 10, 12, 15)
 */
fun multiplySet(set1: Set<Int>, set2: Set<Int>): Set<Int> {
/**
 * Given two sets, return the result of multiplying each element in set1 by each element in set2
 * and storing the results in a new set.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The set containing the multiplied elements.
 * @throws IllegalArgumentException If either set1 or set2 is not a set.
 *
 * Example:
 * multiplySet(setOf(1, 2, 3), setOf(4, 5)) -> setOf(4, 5, 8, 10, 12, 15)
 */
fun multiplySet(set1: Set<Int>, set2: Set<Int>): Set<Int> {

    if (set1 !is Set<*> || set2 !is Set<*>) {
        throw IllegalArgumentException("Both set1 and set2 must be sets")
    }

    val multipliedSet = mutableSetOf<Int>()

    for (element1 in set1) {
        for (element2 in set2) {
            multipliedSet.add(element1 * element2)
        }
    }

    return multipliedSet
}