# 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. May 9, 2011 at 12:40 PM

```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");
}
}
}
```

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
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.... And this program is implemented to find the roots of the quadratic equation. The given
How to find hashtable size in Java?
How to find hashtable size in Java?  Hi, What is the code for Hashtable in Java? How to find hashtable size in Java? Give me the easy code. Thanks
How to find java jobs at any where in india
How to find java jobs at any where in india   Hi, I want information about java related jobs in india.where can i find that details
how to find the sum of integers in a string of sentence in java
how to find the sum of integers in a string of sentence in java  how to find the sum of integers in a string of sentence in java for e.g:--> abc d 2 3 21 the output should be 2+3+21=26
how to find the eigenvalue and eigenvector of n*n matrix in java
how to find the eigenvalue and eigenvector of n*n matrix in java  I m the new beginner in java and want to find eigenvalue and eigenvector of n*n matrix.where n is vary from n=4,5,6...... pls help me that would be appreciable
How to find unweighted Path with Less weighted path in java?
How to find unweighted Path with Less weighted path in java?  I have methods to find weighted and unweighted(Djistra) so I to output unweighted path that has less weighted cost...e.g if I have A->B->C and A->F->C
quadratic equation  program to find roots of a quadratic equation...); System.out.println("Quadratic Equation is ax2+bx+c"); System.out.println("Enter value...))/(2*a); System.out.println("Roots are distinct"); System.out.println( root1
How to find the size of a dynamic webpage using java... eg : Youtube........
How to find the size of a dynamic webpage using java... eg : Youtube........  package newpack; import java.io.BufferedInputStream; import...... Please help... Thanks, Ramit   the above code is running on JAVA
how to find inverse of n*n 2d array in java
how to find inverse of n*n 2d array in java  I reached upto code of printing the matrix as: Assume that matrix is square matrix where row=column code is: public class ReadContents{ public static void main(String args
ModuleNotFoundError: No module named 'py-polynomial'
'py-polynomial' How to remove the ModuleNotFoundError: No module named 'py-polynomial' error? Thanks   Hi, In your python...ModuleNotFoundError: No module named 'py-polynomial'  Hi, My
ModuleNotFoundError: No module named 'Roots'
ModuleNotFoundError: No module named 'Roots'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'Roots' How to remove the ModuleNotFoundError: No module named 'Roots'
find and replace in java
find and replace in java  Need 'find and replace' function in Java to find special keyword in XMl such as @,#,!,%..and replace with their corresponding entities
how to find jdk path in ubuntu?
how to find jdk path in ubuntu?  How to find out the path of installed jdk in ubuntu? Could anyone tell that command to execute from terminal.. Thanks
How to Find PHP version and configuration?
How to Find PHP version and configuration?  Find PHP version and configuration   If you want to find the version of PHP, you can just run...: http://www.phpzag.com/find-php-version-and-configuration
'Flask-Roots' How to remove the ModuleNotFoundError: No module named 'Flask-Roots' error? Thanks   Hi, In your python environment...ModuleNotFoundError: No module named 'Flask-Roots'  Hi, My Python
java find the error1
java find the error1  package com.test.dao; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class DBConnections { public static String userName=""; public static String
How to find a servlet object by name?
How to find a servlet object by name?  How can we locate a servlet object in the code by it's object name?   A. In web.xml you map servlet and define url pattern. Now this url-pattern is used for calling servlet. <
How to find maximum value in ArrayList
How to find maximum value in ArrayList  **Sir i am writing below code but its not working.i don't know how to implement logic my requirement.My requirement is find maximum value in userdefined objects and dispaly that object
How to find maximum value in ArrayList
How to find maximum value in ArrayList  **Sir i am writing below code but its not working.i don't know how to implement logic my requirement.My requirement is find maximum value in userdefined objects and dispaly that object
How to find maximum value in ArrayList
How to find maximum value in ArrayList  **Sir i am writing below code but its not working.i don't know how to implement logic my requirement.My requirement is find maximum value in userdefined objects and dispaly that object
How to find maximum value in ArrayList
How to find maximum value in ArrayList  **Sir i am writing below code but its not working.i don't know how to implement logic my requirement.My requirement is find maximum value in userdefined objects and dispaly that object
java find the error2
java find the error2  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String temp=request.getRequestURI
java find the error3
java find the error3  public String studentDel(StudentBean studObj) throws ClassNotFoundException, SQLException { Connection conObj=DBConnections.setConnection(); PreparedStatement ps
java find the error4
java find the error4  public String executeStudentInsert(HttpServletRequest request ) throws ClassNotFoundException, SQLException { StudentBean beanObj = new StudentBean(); beanObj.setStudentName(request.getParameter("Name
java find the error7