Easiest way to find Square Root in Swift?

前端 未结 6 1881
小鲜肉
小鲜肉 2021-02-18 22:00

I have been trying to figure out how to programmatically find a square root of a number in Swift. I am looking for the simplest possible way to accomplish with as little code ne

6条回答
  •  礼貌的吻别
    2021-02-18 22:28

    First import import UIKit

    let result = sqrt(25) // equals to 5
    

    Then your result should be on the "result" variable

提交回复
热议问题