Last two test cases are not pass.please check my code

import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
if (n == 1 || n == 2)
System.out.println("-1");

	else if (n % 2 == 0) {

		int var = 1 * n * n / 4;

		System.out.print(var - 1 + " ");
		System.out.println(var + 1 + " ");
	}

	else if (n % 2 != 0) {

		int var = 1 * n * n + 1;

		System.out.print(var / 2 - 1 + " ");
		System.out.println(var / 2 + " ");
	}
}

}
Close

Hi @Anshuman-Behera-1168641663271515

Read the constraints carefully. You need to use long to solve the question.

Hi Anshuman
As you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.

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.