To calculate the square root of any value in Euphoria, we leverage the math method, sqrt()
.
sqrt()
methodThe sqrt()
method in Euphoria is part of the standard math library and returns the square root of any integer it is provided with.
sqrt(value)
value
: This is an integer or sequence of integer values whose square root value is to be computed.
The sqrt()
method returns the square root of the number or the sequence of numbers provided.
To run the code below or any code using math methods, we have to include the std/math.e
file in such a program. We can see this here:
include std/math.e--declare variablessequence seq1, seq2--assign values to sequence declaredseq1 = {4,16,36,49,64}seq2 = {3,5,7,9,15}--print the values of some numbersprint(1, sqrt(144))--get square root of seq1 and seq2puts(1,"\nThe square root of {4,16,36,49,64} is: ")print(1,sqrt(seq1))puts(1,"\nThe square root of {3,5,7,9,15} is: ")print(1,sqrt(seq2))
seq1
and seq2
.144
to the screen.seq1
and seq2
.