ruby method

Ruby code posted by jin
created at 14 Apr 02:25

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
def self.multiples_of_3_and_5(number)

    #this is cool

    x = 0;

    (1...number).each do |n|

      if n % 3 == 0 || n % 5 == 0

        x = x + n

      end

    end

    x

  end
204 Bytes in 2 ms with coderay