Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static int largest_triple(int x)
- {
- int resultPerimeter = 0;
- for (int a = 1; a < x; a++)
- {
- for (int b = 1; b < x; b++)
- {
- double c = Math.Sqrt(Math.Pow(a, 2) + Math.Pow(b, 2));
- if (c % 1 == 0 && c >= x)
- {
- int perimeter = a + b + (int)c;
- if (resultPerimeter == 0 || resultPerimeter < perimeter)
- {
- resultPerimeter = perimeter;
- }
- }
- }
- }
- return resultPerimeter;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement