Only two test cases passed,
All Test cases are not passing
Hey @Vipin_coder
output format
Two numbers X and Y denoting the rest of the numbers of the Pythagorean triplet in increasing order.
try for 12
output: 35 37.
This is a formula based question.
if (n == 1 || n == 2) {
System.out.println(-1);
} else if (n % 2 == 0) {
System.out.println(((n * n) / 4) - 1 + " " + (((n * n) / 4) + 1));
} else if (n % 2 != 0) {
System.out.println((n * n - 1) / 2 + " " + (n * n + 1) / 2);
}
Thanks, my code is working now for all test cases, i changed int to long only,.