Open In App

Ruby | Numeric quo() function

Improve
Improve
Like Article
Like
Save
Share
Report

The quo() is an inbuilt method in Ruby returns the most exact division, whether it be a float or a rational one.

Syntax: num.quo()

Parameters: The function needs a number which is to be checked.

Return Value: It returns the most exact division.

Example 1:




# Ruby program for quo()
# method in Numeric
  
# Initialize a number 
num1 = 10
num2 = 7
  
# Prints the quo
puts num1.quo(num2)


Output:

10/7

Example 2:




# Ruby program for quo()
# method in Numeric
  
# Initialize a number 
num1 = 10
num2 = 5
  
# Prints the quo
puts num1.quo(num2)


Output:

2/1

Last Updated : 19 Mar, 2024
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads