Quadratic Equation

Sir, see my code
what’s wrong with it .

Hey @sb8031151_af528e7b895c738c You have hard coded the values of a, b and c. Instead you need to take input from user using Scanner.

but still all the test cases are going to be wrong.

Hey @sb8031151_af528e7b895c738c As I can see from your code you still haven’t take any input using Scanner. b and c are still hardcoded.

Sorry sir, I don’t understand the meaning of ‘hardcoded’

Hey @sb8031151_af528e7b895c738c As I can see from your last submitted code you have cured all the errors except on silly mistake.
when roots are real and distinct you have to print exactly :
Real and Distinct
4 7
but you rcode is printing like this :
Roots are real & distinct
4 7
Dont use unnecessary spaces or words bcoz online judge will make your submission for wrong for that . Print exactly like what is given in question.)
Modified code is :

import java.util.*;
public class Main {
    public static void main(String args[]) {

		   Scanner scn= new Scanner(System.in);
        int a=scn.nextInt();
        int b=scn.nextInt();
        int c=scn.nextInt();

        int d=(b*b-4*a*c);
        int r1=(int)(-b-Math.sqrt(d))/2*a;
        int r2=(int)(-b+Math.sqrt(d))/2*a;

       //1
     //System.out.print(d);
        
        if(d>0){
            System.out.println("Real and Distinct");
            System.out.println((int)r1+" "+(int)r2);

        }else if(d==0){
            System.out.println("Real and Equal");
            System.out.println(r1+" "+r2);
        }else{
            System.out.println("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.