diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-06-20 20:10:05 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-06-20 20:10:05 +0200 |
| commit | e794020d8b881ede726338be50eaa461a134889f (patch) | |
| tree | 99f32380378fa6813d7ccf15b56d8b48fcd263c2 /julia/009-special_pythagorean_triplet.jl | |
| parent | 16a3e5fc6728f1c0d414983f6e1fc3fc160034b3 (diff) | |
| download | project_euler-e794020d8b881ede726338be50eaa461a134889f.tar.gz project_euler-e794020d8b881ede726338be50eaa461a134889f.tar.bz2 project_euler-e794020d8b881ede726338be50eaa461a134889f.zip | |
Refactoging julia problems with function chainning
Diffstat (limited to 'julia/009-special_pythagorean_triplet.jl')
| -rw-r--r-- | julia/009-special_pythagorean_triplet.jl | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/julia/009-special_pythagorean_triplet.jl b/julia/009-special_pythagorean_triplet.jl index 65404be..6723e66 100644 --- a/julia/009-special_pythagorean_triplet.jl +++ b/julia/009-special_pythagorean_triplet.jl @@ -13,14 +13,10 @@ using Base.Iterators -for c in countfrom(1) - for b in 1:(c - 1) - for a in 1:(b - 1) - if a ^ 2 + b ^ 2 == c ^ 2 && a + b + c == 1000 - println(a * b * c) - exit(0) - end - end +for c in countfrom(1), b in 1:(c - 1), a in 1:(b - 1) + if a ^ 2 + b ^ 2 == c ^ 2 && a + b + c == 1000 + println(a * b * c) + break end end |
