Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Ruby | Numeric fdiv() function

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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:




# Ruby program for fdiv() method in Numeric
  
# Initialize a number 
num1 = 15
  
# Prints division of num1/4
puts num1.fdiv(4)

Output:

3.75

Example 2:




# Ruby program for fdiv() method in Numeric
  
# Initialize a number 
num1 = 20
  
# Prints division of num1/2
puts num1.fdiv(2)

Output:

10.0
My Personal Notes arrow_drop_up
Last Updated : 06 Jan, 2020
Like Article
Save Article
Similar Reads