Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main (){
- int a,b,c;
- cout << " nhap so a = ";cin>>a;
- cout<< " nhap so b = ";cin>>b;
- cout << " nhap so c = ";cin>>c;
- int (denta) = b*b - 4*a*c ;
- if (denta > 0){
- cout << "phuong trinh co nghiem x1 = "<< (-b+sqrt(denta))/2*a;
- cout << "phuong trinh co nghiem x2 = "<< (-b-sqrt(denta))/2*a;
- }
- else if (denta = 0){
- cout<< " phuong trinh co nghiem kep x1 = x2 = "<<(-b)/2*a;
- }
- else
- cout << "phuong trinh vo nghiem" ;
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement