Horje
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:




# 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"

Output :

Division a/b : 2.0

Division b/a : 0.5

Example #2:




# 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"

Output :

Division a/b : 0.0

Division b/a : Infinity



Reffered: https://www.geeksforgeeks.org


Ruby

Related
Ruby Float rationalize() method with example Ruby Float rationalize() method with example
Ruby Float zero?() method with example Ruby Float zero?() method with example
Ruby Integer next function with example Ruby Integer next function with example
Ruby Integer modulo() function with example Ruby Integer modulo() function with example
Ruby Integer magnitude function with example Ruby Integer magnitude function with example

Type:
Geek
Category:
Coding
Sub Category:
Tutorial
Uploaded by:
Admin
Views:
9