Bài làm:
#include <iostream.h>#include <math.h>void main(){float a,b,c;float detal;float x1,x2;cout << "Moi nhap vao cac so: ";cin >> a >> b >> c;detal = b*b - 4*a*c;if(detal < 0)cout << "Phuong trinh vo nghiem!";else if(detal == 0)cout << "Phuong trinh co hai nghiem kep: " << -b/2*a;elsecout << "Phuong trinh co hai nghiem: x1 = " << b+sqrt(detal))/2*a << " va x2 = " << (-b-sqrt(detal))/2*a;getch();}