Home »
Julia
denominator() function in Julia
Julia | denominator() function: In this tutorial, we are going to learn about the denominator() function with example in Julia programming language.
Submitted by IncludeHelp, on March 30, 2020
Julia | denominator() function
denominator() function is a library function in Julia programming language, it is used to get the denominator of the rational representation of the given value.
Syntax:
denominator(x)
Here, x is the rational representation.
Example:
denominator(1//2)
2
denominator(2//3)
3
denominator(2//4)
2
Program:
# Example of denominator() function in Julia
x = 1//2
y = 2//3
z = 2//4
println("denominator(x): ", denominator(x))
println("denominator(y): ", denominator(y))
println("denominator(z): ", denominator(z))
println()
a = 2
b = 3
c = 4
println("denominator(a): ", denominator(a))
println("denominator(b): ", denominator(b))
println("denominator(c): ", denominator(c))
println()
Output
denominator(x): 2
denominator(y): 3
denominator(z): 2
denominator(a): 1
denominator(b): 1
denominator(c): 1
Reference: Julia Base.denominator()