Same problem. run time erroe

import java.util.Scanner;

public class QUADRATIC {

public static void main(String[] args) {
	Scanner input=new Scanner(System.in);
	int t;
	t=input.nextInt();
	while(t>0) {
	int a,b,c;
	int N,n;
	a=input.nextInt();
	b=input.nextInt();
	c=input.nextInt();
	int dicr=((b*b)-(4*a*c));

	int root=(int)Math.sqrt(dicr);
	  if(dicr<0) {
		
	         }
	  else if(dicr==0) {
			n=(-b+root)/2*a;
			N=(-b-root)/2*a;
    	System.out.print((int)N+" "+(int)n);
	  }
    else if(dicr>0) {
		n=(-b+root)/2*a;
		
		N=(-b-root)/2*a;
		
		if(N>n) {
			System.out.print((int)n+" "+(int)N);
		}
		else {
			System.out.print((int)N+" "+(int)n);
		}
	}
    	
    t--;
}
}

}

its always recommended to save your code in an IDE and send the link of that.

the problem is that int root=(int)Math.sqrt(dicr); line should come later in the code. you are computing this even if dicr is -ve.

updated code: https://ide.codingblocks.com/s/215280

please rate and resolve if satisfied.
thanks

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.