Posts by Jair Silva • 11 points
2 posts
-
1
votes3
answers113
viewsA: Rest of division in ruby
I got it solved like this resultado =[] values.map do |num1| divisor = values.select{|num2| num1 % num2 == 0} resultado << divisor end resultado.inject(:+) I made a noose inside of another to…
rubyanswered Jair Silva 11 -
-3
votes3
answers113
viewsQ: Rest of division in ruby
I have a array of values: values = [2, 7, 15, 11, 5] I would like to take only the values that divide between them give rest '0' (return 15 and 5). I’m getting it this way, but the code will read…
rubyasked Jair Silva 11