Sqr
 
Returns a square root of a number

Syntax
Usage

result = Sqr ( number )

Parameters

number
the number (greater than or equal to zero)

Return Value

Returns the square root of the argument number.

If number equals zero, Sqr returns zero.

If number is less than zero, Sqr returns a domain error (-1.#IND).

Description

This is the same as raising the argument number to the one-half power ( ^ 1/2). The required number argument can be any valid numeric expression greater than zero.

Example

Dim a As Single
Dim b As Single

Input "Please enter one side of a right triangle: ",a
Input "Please enter another side of a right triangle: ",b
Print ""
Print "The hypotenuse of the triangle has a length of"; Sqr ( a * a + b * b )

Sleep


The output would look like:
Please enter one side of a Right triangle: 3
Please enter another side of a Right triangle: 4
The hypotenuse of the triangle has a length of 5

Differences from QB

  • None

See also