solutions: 9
This commit is contained in:
parent
bcfc1bd6d0
commit
49a87c045c
17
special_pythagorean_triplet.rs
Normal file
17
special_pythagorean_triplet.rs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
fn main() {
|
||||||
|
'algorithm: loop {
|
||||||
|
for i in 1..1000 {
|
||||||
|
for j in 1..1000 {
|
||||||
|
for k in 1..1000 {
|
||||||
|
let pythagoras: f64 = (i as f64).powf(2.) + (j as f64).powf(2.);
|
||||||
|
if pythagoras == (k as f64).powf(2.) {
|
||||||
|
if i+j+k == 1000 {
|
||||||
|
println!("{}", i*j*k);
|
||||||
|
break 'algorithm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue