I am unable to pass test case 2 . What is wrong in my code?
Pythagoras triplet
@adityakumarsingh226,
For the input 6, your code gives output 8 and 91.
https://ide.codingblocks.com/s/240603 corrected code
System.out.println(var - 1 + " " + var + 1);
In the above code, everything after " " becomes a string. Hence instead of adding 1 to var. It just appends the character 1 to the string.
Say the input is 6. var = 9
The string is “8 91” Here everything before " " is a integer. But after " " becomes a part of the string.
To correct this do:
System.out.println(var - 1 + " " + (var + 1));
Put var + 1 inside parenthesis.