MCPcopy Create free account
hub / github.com/StudyRust/leetcode_rust / count_triples

Function count_triples

1925-count-square-sum-triples.rs:1–13  ·  view source on GitHub ↗
(n: i32)

Source from the content-addressed store, hash-verified

1pub fn count_triples(n: i32) -> i32 {
2 let mut counter = 0;
3 for i in 1..n+1 {
4 for j in 1..n+1 {
5 for k in 1..n+1 {
6 if i * i + j * j == k * k {
7 counter += 1;
8 }
9 }
10 }
11 }
12 counter
13}
14
15fn main() {
16 println!("{:?}", count_triples(10));

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected