Swift Program To Find The Square Root Of A Number Using The Sqrt() Function

You are currently viewing Swift Program To Find The Square Root Of A Number Using The Sqrt() Function

Swift Program To Find The Square Root Of A Number Using The Sqrt() Function

// Swift program to find the square root of a number
// using the sqrt() function

import Swift
import Foundation

var num:Double  =   16.0
var res:Double  =   0.0

res = sqrt(num)

print("Square root is: ",res)

Output

Square root is:  4.0

...Program finished with exit code 0
Press ENTER to exit console.

Ranjith

Hi, I'm Manoj a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply