Code-
import java.util.;
public class Main
{
public static void main(String[] args)
{
int a, b, c, root1, root2;
double d;
Scanner s = new Scanner(System.in);
a = s.nextInt();
b = s.nextInt();
c = s.nextInt();
d = b * b - 4 * a * c;
if(d > 0)
{
System.out.println(“Real and Distinct”);
root1 = (int)(( - b + Math.sqrt(d))/(2a));
root2 = (int)((-b - Math.sqrt(d))/(2a));
System.out.print(root1+" ");
System.out.print(root2);
}
else if(d == 0)
{
System.out.println(“Real and Equal”);
root1 = (int)((-b+Math.sqrt(d))/(2a));
System.out.println(root1);
}
else
{
System.out.println(“Imaginary”);
}
}
}
Error-
Exception in thread “main” java.util.InputMismatchException
at java.base/java.util.Scanner.throwFor(Scanner.java:939)
at java.base/java.util.Scanner.next(Scanner.java:1594)
at java.base/java.util.Scanner.nextInt(Scanner.java:2258)
at java.base/java.util.Scanner.nextInt(Scanner.java:2212)
at Main.main(Main.java:9)