Related Articles

Related Articles

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:



filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

2

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

1
My Personal Notes arrow_drop_up
Recommended Articles
Page :