the program is working properly but when i submit if fails on test 3 I want to know why?
Wanna know the failure
import java.util.; public class Main { public static void main(String args[]) { Scanner scn=new Scanner(System.in); int n=scn.nextInt(); long x,y, hyp=0,perp=0,base=0; if (n<=Math.pow(10,9)); for(x=n;x<=10000;x++){ for(y=n;y<=10000;y++) { if(xx==(yy)+(nn) || yy==(xx)+(nn) || nn==(xx)+(yy)) { if(x>y && x> n) { hyp=x; perp=n; base=y;} else if(y>x && y>n) { hyp=y; perp=n; base=x;} else { hyp=n; perp=x; base=y;} } } }if(base<perp) System.out.println( perp +" " + hyp); else if(perp<base) System.out.println(base +" " + hyp); else System.out.print("-1"); } }
please check the code if something is missing
Hey
Change data Type int to long
try for this input
99999993
correct output :
4999999300000024 4999999300000025
@nmn,
What doubt are you having buddy?
Can you please share the latest code that you wrote for this problem?