Issue with Array Devisal

We have task to find all number in array divisal by 3 and 5, we could not able to create code for it… please assists us -

def divisiblity_test(variable1, variable2)
    #Write your code here
    result = []
    for range(variable1, variable2)
   
    return result
end

Feels like I shouldn’t complete someone’s simple homework, but here you go:

def divisibility_test(variable1, variable2)
	#Write your code here
	(variable1..variable2).select { |x| x.modulo(15).zero? }
end

thanks a lot for your quick help

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs