Quadritic equations (i am not able to find the error in it)

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner s = new Scanner(System.in);
int a = s.nextInt();
int b = s.nextInt();
int c = s.nextInt();
int x1, x2;

	int d = (b * b) - (4 * a * c);
	double d1 = (double)Math.sqrt(d);

	x1 = (int) ((-b + d1) / (2 * a));
	x2 = (int) ((-b - d1) / (2 * a));
	if (d > 0) {
		System.out.println("Real and Distinct");

		System.out.println(x1 + " " + x2);

	} else if (d == 0) {
		System.out.println("Real and Equal");

		System.out.println(x1 + " " + x2);
	} else {
		System.out.println("imaginary");
	}

}

}

Print smaller root first and change imaginary to “Imaginary”

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.