Skip to content
Snippets Groups Projects
Commit 7f84957f authored by Léo Vigna's avatar Léo Vigna
Browse files

SWIFT_Q2

parent 3eac9950
No related branches found
No related tags found
No related merge requests found
/// Returns the prime numbers in `elements`.
// Les bornes de la deuxième boucle ne sont pas correctes.
func primes(_ numbers: [Int]) -> [Int] {
var primes: [Int] = []
for n in numbers {
var isPrime = true
for m in 1 ..< n {
for m in stride(from: 2, through:n-1, by: 1){
if n % m == 0 {
isPrime = false
break
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment