Last active
December 17, 2015 04:39
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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