2nd exercise

This commit is contained in:
piks3l 2017-06-24 01:16:40 +02:00
parent 89a7d27ed5
commit 3dc8c60ebd

15
ruby_algo/ex2.rb Normal file
View file

@ -0,0 +1,15 @@
max = 4_000_000
a, b = 1, 2
c = 3
sum = 0
while b < max do
sum += b if b % 2 == 0
c = (a + b)
puts "#{c} = #{a} + #{b}"
a, b = b, c
end
puts sum