Problem pyhtagorean triplet

import java.util.;
public class Main {
public static void main(String args[]) {
boolean status = false;
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
for(int i = 1;i<=100;i++){
for(int j = 1;j<=100;j++){
if(i
i+jj == nn&&i<j){
System.out.print(i + " "+ j);
}else if(ii + nn == jj){
System.out.print(i + " "+ j);
}else if(j
j + nn == ii){
System.out.print(j+ " " + i);
}else{
status = true;
}
}
}
if(status){
System.out.println(-1);
}
}
}====what’s the error in code

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);
    }

pls try to figure out the mathmatical approach or formula
don’t use the loop

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.