Exercise 2: Finding Modulo

Write code to take modulo of two numbers.

Modulo operator

In Ruby, the % symbol represents the modulo operator. The modulo of two positive numbers is the remainder we get if we divide the first number by the second number. For example, the code below prints 1.

puts 5 % 2

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy