brewersfan1976

first_multiple2.rb

Mar 6th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.34 KB | None | 0 0
  1. def firstMultiple2(divisors, start)
  2.     x =  start
  3.     array_length = divisors.length
  4.     y = 0
  5.    
  6.     while(1)
  7.         while (y < array_length)
  8.             if x % divisors[y] == 0 then
  9.                 return x
  10.             end
  11.                
  12.             y = y + 1
  13.         end
  14.            
  15.         y = 0
  16.         x = x + 1
  17.     end
  18. end
Advertisement
Add Comment
Please, Sign In to add comment