Checking if a number is odd in Julia – isodd() Method
Last Updated :
21 Apr, 2020
The isodd()
is an inbuilt function in julia which is used to return true if the specified value x is odd i.e, not divisible by 2 else returns false.
Syntax: isodd(x::Integer)
Parameters:
Returns: It returns true if the specified value x is odd i.e, not divisible by 2 else returns false.
Example 1:
println(isodd( 0 ))
println(isodd( 1 ))
println(isodd( - 2 ))
|
Output:
false
true
false
Example 2:
println(isodd( 6 ))
println(isodd( 7 ))
println(isodd( - 10 ))
println(isodd( - 11 ))
|
Output:
false
true
false
true
Share your thoughts in the comments
Please Login to comment...