Related Articles

Related Articles

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:



filter_none

edit
close

play_arrow

link
brightness_4
code

# 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))

chevron_right


Output:

0
0
1

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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))

chevron_right


Output:

2
0
1.2999999999999998
NaN
2
-1
My Personal Notes arrow_drop_up
Recommended Articles
Page :