program to find roots of a quadratic equation? December 23, 2010 at 12:05 PM

Hi Friend,

Try the following code:

```import java.util.*;
public static void main(String args[]) throws Exception{
double root,root1,root2;
Scanner input=new Scanner(System.in);
System.out.println("Enter value of a");
int a=input.nextInt();
System.out.println("Enter value of b");
int b=input.nextInt();
System.out.println("Enter value of c");
int c=input.nextInt();
int d=(b*b)-(4*a*c);
if(d>0)
{
root1=(-b + Math.sqrt(d))/(2*a);
root2=(-b - Math.sqrt(d))/(2*a);
System.out.println("Roots are distinct");
System.out.println( root1 + "," + root2);
}
else if(d==0)
{
root=(-b)/(2*a);
System.out.println("Only one root is distinct");
System.out.println(root);
}
else if(d<0)
{
System.out.println("Roots are imaginary");
}
}
}
```

Thanks

quadratic equation  program to find roots of a quadratic equation?   Hi Friend, Try the following code: import java.util.*; class...); System.out.println("Quadratic Equation is ax2+bx+c"); System.out.println("Enter value
Java find the roots of quadratic equation
Java find the roots of quadratic equation In this tutorial, you will learn how to find the roots of quadratic equation. Quadratic Equations are always in the form ax2 + bx + c = 0. Every Quadratic equation has two roots
ModuleNotFoundError: No module named 'quadratic'  Hi, My Python... 'quadratic' How to remove the ModuleNotFoundError: No module named 'quadratic' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'quadratic'  Hi, My Python... 'quadratic' How to remove the ModuleNotFoundError: No module named 'quadratic' error? Thanks   Hi, In your python environment you
extract equation
extract equation  I want to extract equation from doc.   Hi Friend, Which equation you want to extract from the word document? Clarify this! Thanks
Extarct equation
Extarct equation  Want to extarct equation of the form ax+by+c=0 from any word document.   Hi Friend, Try this: import java.io.*; import java.util.*; import org.apache.poi.hwpf.HWPFDocument; import
ModuleNotFoundError: No module named 'Equation'
ModuleNotFoundError: No module named 'Equation'  Hi, My Python... 'Equation' How to remove the ModuleNotFoundError: No module named 'Equation... to install padas library. You can install Equation python with following
ModuleNotFoundError: No module named 'Equation'
ModuleNotFoundError: No module named 'Equation'  Hi, My Python... 'Equation' How to remove the ModuleNotFoundError: No module named 'Equation... to install padas library. You can install Equation python with following
ModuleNotFoundError: No module named 'djangocms-equation'
ModuleNotFoundError: No module named 'djangocms-equation'  Hi, My... named 'djangocms-equation' How to remove the ModuleNotFoundError: No module named 'djangocms-equation' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'djangocms-equation'
ModuleNotFoundError: No module named 'djangocms-equation'  Hi, My... named 'djangocms-equation' How to remove the ModuleNotFoundError: No module named 'djangocms-equation' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'equation-solver'
ModuleNotFoundError: No module named 'equation-solver'  Hi, My... named 'equation-solver' How to remove the ModuleNotFoundError: No module named 'equation-solver' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'equation-cipher'
ModuleNotFoundError: No module named 'equation-cipher'  Hi, My... named 'equation-cipher' How to remove the ModuleNotFoundError: No module named 'equation-cipher' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'equation-solver'
ModuleNotFoundError: No module named 'equation-solver'  Hi, My... named 'equation-solver' How to remove the ModuleNotFoundError: No module named 'equation-solver' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'symbolic-equation'
ModuleNotFoundError: No module named 'symbolic-equation'  Hi, My... named 'symbolic-equation' How to remove the ModuleNotFoundError: No module named 'symbolic-equation' error? Thanks   Hi, In your
Extracting equation from any document
Extracting equation from any document  how can i extract equation from any word document?   Hello Friend, If you want to extract data from the word file, then visit the following link: Extract data from word document
ModuleNotFoundError: No module named 'hml_equation_parser'
ModuleNotFoundError: No module named 'hml_equation_parser'  Hi, My... named 'hml_equation_parser' How to remove the ModuleNotFoundError: No module named 'hml_equation_parser' error? Thanks   Hi
ModuleNotFoundError: No module named 'hml_equation_parser'
ModuleNotFoundError: No module named 'hml_equation_parser'  Hi, My... named 'hml_equation_parser' How to remove the ModuleNotFoundError: No module named 'hml_equation_parser' error? Thanks   Hi
ModuleNotFoundError: No module named 'template-from-equation'
ModuleNotFoundError: No module named 'template-from-equation'  Hi...: No module named 'template-from-equation' How to remove the ModuleNotFoundError: No module named 'template-from-equation' error? Thanks   Hi
ModuleNotFoundError: No module named 'template-from-equation'
ModuleNotFoundError: No module named 'template-from-equation'  Hi...: No module named 'template-from-equation' How to remove the ModuleNotFoundError: No module named 'template-from-equation' error? Thanks   Hi
how to find the roots of polynomial equation of 'n'th degree in java
how to find the roots of polynomial equation of 'n'th degree in java  i am new to java field and i wanted to find the roots of nth degree polynomial equation pls help me. thanks
-and-normal-equation'  Hi, My Python program is throwing following error...-and-normal-equation' How to remove the ModuleNotFoundError: No module named 'minimise-functions-gradient-descent-and-normal-equation' error
-and-normal-equation'  Hi, My Python program is throwing following error...-and-normal-equation' How to remove the ModuleNotFoundError: No module named 'minimise-functions-gradient-descent-and-normal-equation' error
write a program to evaluate the following investment equation make use of wrapper class v=p(1+r)rest to n
write a program to evaluate the following investment equation make use of wrapper class v=p(1+r)rest to n  write a program to evaluate the following investment equation make use of wrapper class v=p(1+r)rest to n
java
java  how to write a java program to solve quadratic equation
java
java  how to write a java program to solve a quadratic equation
i cNT GET ANSWER FOR THIS QUESTION
- 4ac â�?�¥ 0, the program should output the roots of the quadratic equation...i cNT GET ANSWER FOR THIS QUESTION  The roots of the quadratic equation ax2+bx+c=0, aï�??¹0 are given by the following formula: x=(-b�