Created
June 11, 2020 15:21
-
-
Save alexandregama/4f53cb0b56e2694cd33f88f3faaf9ae6 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
def sum_prime_number(array) | |
sum = 0 | |
for item in array | |
if is_prime_number(item) | |
sum += item | |
end | |
end | |
return sum | |
end | |
array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
puts sum_prime_number(array) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment