Ruby | Numeric % method
Last Updated :
18 Jan, 2021
The % is an inbuilt method in Ruby returns the modular value when two numbers are divided. It returns the value of a % b.
Syntax: a % b
Parameters: The function needs two number whose modulus on division is returned.
Return Value: It returns the modulus when two numbers are divided.
Example 1:
Output:
3
Example 2:
Output:
1
Share your thoughts in the comments
Please Login to comment...