Ruby | Numeric divmod() function Last Updated : 12 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The divmod() is an inbuilt method in Ruby returns the integer quotient and modulus after performing the division. Syntax: num1.divmod(num2) Parameters: The function needs two numbers whose integer division is to be performed. Return Value: It returns returns the integer quotient and modulus after performing the division..Example 1: CPP #Ruby program for divmod() method in Matrix #Initialize a number num1 = 15 #Prints quotient and modulus of num1 / 4 puts num1.divmod(4) Output: 33Example 2: CPP #Ruby program for divmod() method in Matrix #Initialize a number num1 = 20 #Prints quotient and modulus of num1 / 2 puts num1.divmod(2) Output: 100 Comment More infoAdvertise with us Next Article Ruby | Numeric denominator() function G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Numeric-class Similar Reads Ruby | Numeric div() function The div() is an inbuilt method in Ruby that returns the result after performing an integer division. Syntax: num1.div(num2) Parameters: The function needs two numbers whose integer division is to be performed. Return Value: It returns returns the integer division.Example 1: CPP #Ruby program for div 1 min read Ruby | Numeric fdiv() function The fdiv() is an inbuilt method in Ruby returns the result after performing a float division. Syntax: num1.fdiv(num2) Parameters: The function needs two numbers whose float division is to be performed. Return Value: It returns returns the float division. Example 1: CPP # Ruby program for fdiv() meth 1 min read Ruby | Numeric floor() function The floor() is an inbuilt method in Ruby returns a number less than or equal to the given number with a precision of the given number of digits after the decimal point. In case the number of digits is not given, the default value is taken to be zero. Syntax: num.floor(ndigits) Parameters: The functi 1 min read Ruby | Numeric abs() function The abs is an inbuilt method in Ruby returns the absolute value of a number.  Syntax: num.abs Parameters: The function needs the number whose absolute value is to be returned. Return Value: It returns the absolute value of a numbers. Example 1:  Ruby # Ruby program for abs() method in Numeric # I 1 min read Ruby | Numeric denominator() function 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: CPP # Ruby program for denominator() method in Matrix # Initialize 1 min read Ruby | Numeric coerce() function The coerce() is an inbuilt method in Ruby returns an array containing two numbers containing two float numbers. Syntax: num1.coerce(num2) Parameters: The function needs a number and ndigits to which the precision of decimal digits is kept. In case no ndigits is passed it takes 0 to be the default v 1 min read Like