Getting the remainder value after division in Julia – mod() Method
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:
# Julia program to illustrate # the use of mod() method # Getting remainder when the specified# dividend is divided by divisor.println(mod(0, 3))println(mod(1, 1))println(mod(7, 2)) |
Output:
0 0 1
Example 2:
# Julia program to illustrate # the use of mod() method # Getting remainder when the specified# dividend is divided by divisor.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


