/**
 * This exercise involves performing floating-point arithmetic operations on a given set
 * of numbers using the 'withIndex' function.
 *
 * Given a list of numbers, the task is to compute the sum of all elements by taking the
 * square root of the number at each index, then divide the result by the index value.
 *
 * The function 'floatingPointOperations' takes a list of numbers as input and returns
 * the sum of the computed values.
 */
fun floatingPointOperations(numbers: List<Double>): Double {

    var totalSum = 0.0

    for ((index, num) in numbers.withIndex()) {
        // Square root of the number at each index
        var result = Math.sqrt(num)

        // Divide the result by the index value
        result /= index.toDouble()

        // Adding the computed result to the total sum
        totalSum += result
    }

    return totalSum
}
/**
 * This exercise involves performing floating-point arithmetic operations on a given set
 * of numbers using the 'withIndex' function.
 *
 * Given a list of numbers, the task is to compute the sum of all elements by taking the
 * square root of the number at each index, then divide the result by the index value.
 *
 * The function 'floatingPointOperations' takes a list of numbers as input and returns
 * the sum of the computed values.
 */
fun floatingPointOperations(numbers: List<Double>): Double {
/**
 * This exercise involves performing floating-point arithmetic operations on a given set
 * of numbers using the 'withIndex' function.
 *
 * Given a list of numbers, the task is to compute the sum of all elements by taking the
 * square root of the number at each index, then divide the result by the index value.
 *
 * The function 'floatingPointOperations' takes a list of numbers as input and returns
 * the sum of the computed values.
 */
fun floatingPointOperations(numbers: List<Double>): Double {

    var totalSum = 0.0

    for ((index, num) in numbers.withIndex()) {
        // Square root of the number at each index
        var result = Math.sqrt(num)

        // Divide the result by the index value
        result /= index.toDouble()

        // Adding the computed result to the total sum
        totalSum += result
    }

    return totalSum
}