Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lim = 4000000 # 4 million
- fst_term = 1
- snd_term = 2
- thd_term = 0
- sum = 0
- while ( snd_term < lim )
- if ( snd_term % 2 == 0)
- sum = sum + snd_term
- end
- thd_term = fst_term + snd_term
- fst_term = snd_term
- snd_term = thd_term
- end
- puts sum
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement