import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("sum: ");
int sum = in.nextInt();
System.out.print("product: ");
int product = in.nextInt();
double sqrtD = Math.sqrt(Math.pow(-sum, 2) - (4 * product));
double x1 = (sum + sqrtD) / 2;
double x2 = (sum - sqrtD) / 2;
System.out.println("x=" + x1 + " y=" + x2);
}
}
Comments
Leave a comment