Created
November 23, 2018 01:35
-
-
Save RickArora/ec4fad3599f7252554bd47f412d00a62 to your computer and use it in GitHub Desktop.
This file contains 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
# Write a method that returns a boolean indicating whether the argument is | |
# prime. | |
def prime?(num) | |
(1..num).each do |i| | |
if (num % i == 0 && i != 1 && i != num) || (num == 1) | |
return false | |
end | |
end | |
return true; | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment