Skip to content

Instantly share code, notes, and snippets.

@alexandregama
Created June 11, 2020 15:21
Show Gist options
  • Save alexandregama/4f53cb0b56e2694cd33f88f3faaf9ae6 to your computer and use it in GitHub Desktop.
Save alexandregama/4f53cb0b56e2694cd33f88f3faaf9ae6 to your computer and use it in GitHub Desktop.
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