public static void main(String[] args) {
//nhap du lieu cho cac bien
Scanner sc = new Scanner(System.in);
System.out.print("nhap a = ");
int a = sc.nextInt();
System.out.print("nhap b = ");
int b = sc.nextInt();
System.out.print("nhap c = ");
int c = sc.nextInt();
double t1, t2, x2, x3, x4;
double delta = Math.pow(b, 2) - (4 * a * c);
if (delta < 0) {
System.out.print("phuong trinh vo nghiem\n");
} else {
if (delta == 0) {
t1 = -b / (2 * a);
t2 = t1;
if (t1 < 0 && t2 < 0) {
System.out.print("phuong trinh vo nghiem\n");
} else {
if (t1 >= 0) {
double x1 = Math.sqrt(t1);
x2 = -x1;
System.out.println("x1 = " + x1);
System.out.println("x2 = " + x2);
}
if (t2 >= 0) {
x3 = Math.sqrt(t2);
x4 = -x3;
System.out.println("x3 = " + x3);
System.out.println("x4 = " + x4);
}
}
}
}if (delta>0){t1 = (-b+Math.sqrt(delta))/ (2 * a);
t2 = (-b-Math.sqrt(delta))/ (2 * a);
if (t1 < 0 && t2 < 0) {
System.out.print("phuong trinh vo nghiem\n");
} else {
if (t1 >= 0) {
double x1 = Math.sqrt(t1);
x2 = -x1;
System.out.println("x1 = " + x1);
System.out.println("x2 = " + x2);
}
if (t2 >= 0) {
x3 = Math.sqrt(t2);
x4 = -x3;
System.out.println("x3 = " + x3);
System.out.println("x4 = " + x4);
}
}
}
}}
em đã thử đúng mọi phương án nhưng giải pt giải nghiệm không được ạ, cứ x1 =0, x2=0 , các bro giúp e với