Sqr (function)

<< Click to Display Table of Contents >>

Sqr (function)

Sqr(Num)

Returns the square root of a number.

Num may not be smaller than 0.

Sub Root

 Dim Title, Msg, Number

 Title = "Calculation of the square root"

 Prompt = "Enter a positive number:"

 Number = InputBox(Prompt, Title)

 If Number < 0 Then

         Msg = "The root of negative numbers is not defined."

 Else

         Msg = "The root of " & Number & " is "

         Msg = Msg & Sqr(Number) & "."

 End If

 MsgBox Msg

End Sub