PROGRAM:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
class Quadratic
{
public
static void main(String x[]) throws IOException
{
int
a,b,c,d;
BufferedReader
br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter
xsquare coefficient: ");
a=Integer.parseInt(br.readLine());
System.out.println("Enter
x coefficient : ");
b=Integer.parseInt(br.readLine());
c=-b/a;
System.out.println("\nRoots
are 0 and "+c+"\n");
d=b*b;
System.out.println("\nRoots
are real and distinct with discriminant : "+d);
}
}
No comments:
Post a Comment