Not running for all test cases

@Utkarshsingh5298291,
Use long instead of int.

@Utkarshsingh5298291,
Also for all n<3 print -1, not just for n==1 or n==2. And, use long even in input

still one case not running

@Utkarshsingh5298291,
Print -1 for all n<3. Not just n==1 or n==2

@Utkarshsingh5298291,
Print -1 even for n==0 and n<0

not working still…after editing

@Utkarshsingh5298291,

https://ide.codingblocks.com/s/259727 corrected code

@Utkarshsingh5298291,
Error:
In the case where n%2==0:
Use:

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

Instead of:

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

Because in the above line everything after " " is taken as a string. Hence 1 was not added to var instead it was taken as a string and 1 was appended to the string var.

can you explain why ?System.out.println(var / 2 - 1 + " " + var / 2)); in brackets and n<=0 is needed n<3 satisfies all.

@Utkarshsingh5298291,
I meant that for all n<3 you need to print -1. Even if n is negative. I didn’t mean that you put 2 different conditions

@Utkarshsingh5298291,
System.out.println(2 + " " + 1 + 1 );
What do you think should be answer for this?

ok thanks a lot … i got you…

1 Like