Ruby Float quo() method with example

Float quo() is a float class method which return the quotient value of the division.

Syntax: float.quo()

Parameter: float values – dividend and divisor

Return: Quotient value of the division.

Example #1:



filter_none

edit
close

play_arrow

link
brightness_4
code

# Ruby code for quo() method
  
# Initializing value
a = 4.0
b = 2.0
   
# Printing result
puts "Division a/b : #{a.quo(b)}\n\n"
puts "Division b/a : #{b.quo(a)}\n\n"

chevron_right


Output :

Division a/b : 2.0

Division b/a : 0.5

Example #2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# Ruby code for quo() method
  
# Initializing value
a = 0
b = 2.0
  
# Printing result
puts "Division a/b : #{a.quo(b)}\n\n"
puts "Division b/a : #{b.quo(a)}\n\n"

chevron_right


Output :

Division a/b : 0.0

Division b/a : Infinity
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.