Ruby Integer divmod() function with example Last Updated : 24 Jun, 2020 Comments Improve Suggest changes Like Article Like Report The divmod() function in Ruby returns integer division value and the remainder. Syntax: (number1).divmod(number2) Parameter: The function takes two number number1 and number2 whose integer division and remainder is returned. Return Value: The function returns the integer division value and the remainder. Example #1: Ruby # Ruby program of Integer divmod() function # Initializing the numbers num1 = 15 num2 = 4 num3 = 10 num4 = 2 # Prints the integer division # and its remainder puts num1.divmod(num2) puts puts num3.divmod(num4) Output: 3 3 5 0 Example #2: Ruby # Ruby program of Integer divmod() function # Initializing the numbers num1 = 19 num2 = 2 num3 = 28 num4 = 13 # Prints the integer division # and its remainder puts num1.divmod(num2) puts puts num3.divmod(num4) Output: 9 1 2 2 Comment More infoAdvertise with us Next Article Ruby Integer divmod() function with example G gopaldave Follow Improve Article Tags : Ruby Ruby-Methods Ruby Integer-class Similar Reads Ruby Integer div() function with example The div() function in Ruby returns the integer division of two numbers. Syntax: (number1).div(number2) Parameter: The function needs two numbers number1 and number2, where number1 is the dividend and number2 is the divisor. Return Value: The function returns the integer division of two numbers. Exam 1 min read Ruby Integer even? function with example The even? function in Ruby returns a boolean value. It returns true if the number is even, else it returns false. Syntax: number.even? Parameter: The function takes the integer which is to be checked for even or not. Return Value: The function returns a boolean value which determines if the value is 1 min read Ruby Integer digits function with example The digits function in Ruby returns the digits place of converting the number to the given base in the parameter. If there is no such parameter is provided, then the default base is taken as 10. Syntax: number.digits(base) Parameter: The function takes the integer whose conversion is to be done. It 1 min read Ruby Integer abs() function with example The abs() function in Ruby returns the absolute value of the integer. Syntax: (number).abs Parameter: The function takes the integer whose absolute value is to be returned. Return Value: The function returns the absolute value of the integer. Example #1: Ruby # Ruby program Integer abs() function # 1 min read Ruby Integer gcd() function with example The gcd() function in Ruby returns the gcd of two numbers. GCD signifies the greatest common divisor which divides both the numbers. Syntax: number1.gcd(number2) Parameter: The function requires two numbers whose gcd is to be returned. Return Value: The function returns the gcd of two numbers Exampl 1 min read Like