The abs()
is an inbuilt function in julia which is used to return the absolute value of the specified number x.
Syntax: abs(x)
Parameters:
- x: Specified value.
Returns: It returns the absolute value of the specified number x.
Example 1:
# Julia program to illustrate # the use of abs() method # Getting absolute value of the # specified number x println( abs ( 0 ))
println( abs ( - 2.7 ))
println( abs ( 2 ))
|
Output:
0 2.7 2
Example 2:
# Julia program to illustrate # the use of abs() method # Getting absolute value of the # specified number x println( abs ( 0 ))
println( abs ( - 2.7 ))
println( abs ( - 2.9 ))
println( abs ( 0.7 ))
println( abs ( - 0.2 ))
println( abs ( - 22 ))
|
Output:
0 2.7 2.9 0.7 0.2 22
Article Tags :
Recommended Articles