约数求和 2014/11/18 16072 def divisors(n) sumOfDivisors=0 i=1 while i<n if n%i==0 divisor=i sumOfDivisors=sumOfDivisors+divisor end i=i+1 end puts "The sum of divisors is "+sumOfDivisors.to_s end