func S(A: Double,B: Double) -> Double {
    var C = [0,1.0,0,0,0]
    while (C[0] < B){
        C[4] = 0
        while (C[4] < A){
            C[2] = C[3]
            C[3] += C[1]
            C[4] = C[3]*C[3]
        }
        C[3] = C[2]
        C[1] *= 0.1
        C[0] += 1
    }
    return C[3]
}


print(" \(S(A: 2.0,B: 10.0))")

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: