Hello. I started using Ruby, but I couldn't find a way to check if any value was a multiple, so I made a note.
Use%, which gives the remainder of A divided by B. If it is a multiple of the specified value, 0 should be output.
sample.rb
a = 10
b = 5
if a % b == 0
puts "#{a}Is a multiple of 5."
else
puts "#{a}Is not a multiple of 5."
end
Recommended Posts