sum_even_numbers.lua 191 B

123456789101112131415
  1. #!/usr/bin/lua
  2. -- this will be the sum variable
  3. sum = 0
  4. number = 0
  5. while number ~= 5000 do
  6. number = number + 1
  7. if number % 2 == 0 then
  8. sum = sum + number
  9. end
  10. end
  11. print(sum)