Skip to content
Related Articles

Related Articles

Improve Article
Ruby | Numeric denominator() function
  • Last Updated : 07 Jan, 2020

The denominator() is an inbuilt method in Ruby returns the denominator of the number.

Syntax: num1.denominator()

Parameters: The function needs a number whose denominator is returned.

Return Value: It returns itself only.

Example 1:






# Ruby program for denominator() method in Matrix
  
# Initialize a number 
num1 = 1.5
  
# Function used
num = num1.denominator()
  
# Prints denominator() of num
puts num

Output:

2

Example 2:




# Ruby program for denominator() method in Matrix
  
# Initialize a number 
num1 = 155
  
# Function used
num = num1.denominator()
  
# Prints denominator() of num
puts num

Output:

1
My Personal Notes arrow_drop_up
Recommended Articles
Page :