Posted By

ccw on 03/26/12


Tagged

project Euler


Versions (?)

[Project Euler in Groovy] - P1


 / Published in: Groovy
 

Project Euler in Groovy, Problem 1

  1. final def MAX = 1000
  2. def sum = 0
  3. (3..MAX-1).each {
  4. if (it % 3 == 0 || it % 5 == 0) {
  5. sum += it
  6. }
  7. }
  8. println "sum => $sum"

Report this snippet  

You need to login to post a comment.