#include <stdio.h>
#include <math.h>
#include <conio.h>
int main(){
int a,b,c;
float del,x1,x2;
printf("Nhap phuong trinh:\n"); scanf("%d%d%d", a,b,c);
del = b*b - 4 *a*c;
if (del <0) printf("Phuong trinh vo nghiem");
else {
if (del==0) {
x1 = -b/(2*a); printf("Phuong trinh co mot nghiem la: %f ",x1);
}
else {
x1=(-b+sqrt(del))/(2*a);
x2 = (-b-sqrt(del))/(2*a);
printf("Phuong trinh co 2 nghiem kep la: %f %f",x1,x2);
}
}
return 0;
}
#include <math.h>
#include <conio.h>
int main(){
int a,b,c;
float del,x1,x2;
printf("Nhap phuong trinh:\n"); scanf("%d%d%d", a,b,c);
del = b*b - 4 *a*c;
if (del <0) printf("Phuong trinh vo nghiem");
else {
if (del==0) {
x1 = -b/(2*a); printf("Phuong trinh co mot nghiem la: %f ",x1);
}
else {
x1=(-b+sqrt(del))/(2*a);
x2 = (-b-sqrt(del))/(2*a);
printf("Phuong trinh co 2 nghiem kep la: %f %f",x1,x2);
}
}
return 0;
}