Project Euler #1

Add all the natural numbers below one thousand that are multiples of 3 or 5

# Project Euler problem #1
# Author Saerohoon Yang(yang.sae@gmail.com)

class SumThreeFiveMultiple

  def numbers

    total = 0

    for i in(1..1000)

      if (i%3==0) || (i%5==0)
        total += i
      end

    end

    puts "Total is #{total}"

  end

end

간지나게 github나 bitbucket에 올려서 링크 걸려고 했는데 잘 안된다...

댓글 없음:

댓글 쓰기