Getting the remainder value after division in Julia – mod() Method
Last Updated :
21 Apr, 2020
The mod()
is an inbuilt function in julia which is used to return remainder when the specified dividend is divided by divisor.
Syntax: mod(x, y)
Parameters:
- x: Specified dividend.
- y: Specified divisor.
Returns: It returns remainder when the specified dividend is divided by divisor.
Example 1:
println(mod( 0 , 3 ))
println(mod( 1 , 1 ))
println(mod( 7 , 2 ))
|
Output:
0
0
1
Example 2:
println(mod( 5 , 3 ))
println(mod( 10 , 2 ))
println(mod( 7.3 , 2 ))
println(mod( 1.8 , 0 ))
println(mod( - 6 , 4 ))
println(mod( - 3 , - 2 ))
|
Output:
2
0
1.2999999999999998
NaN
2
-1
Share your thoughts in the comments
Please Login to comment...