Skip to content

Instantly share code, notes, and snippets.

@mjhea0
Last active December 17, 2015 04:39
Show Gist options
  • Select an option

  • Save mjhea0/5552242 to your computer and use it in GitHub Desktop.

Select an option

Save mjhea0/5552242 to your computer and use it in GitHub Desktop.
Using if statements, write a loop that prints out a range of numbers that can be divided by 7 without any remainder.
#Using if statements, write a loop that prints out a range of numbers
#that can be divided by 7 without any remainder.
def seven(nums)
for x in nums
puts x if x % 7 == 0
end
end
nums = 1..100
seven(nums)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment