tuminh968

Untitled

Oct 23rd, 2019
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include<math.h>
  3. using namespace std;
  4. int main(){
  5. int a,b,c;
  6. cout<< " nhap so a =";cin>>a;
  7. cout<<" nhap so b = "; cin>>b;
  8. cout<<"nhap so c = ";cin>>c;
  9. if (a==0){
  10. if(b==0)
  11. {if (c==0)
  12. cout<< "phuong trinh vo nghiem";
  13. else {
  14.  
  15.  
  16. cout << "phuong trinh vo so nghiem";}
  17. else
  18.  
  19.  
  20. cout << "phuong trinh co 1 nghiem ="<<float(-c/b);}
  21. }
  22. else{
  23. cout << " phuong trinh co nghiem x1 = "<<float((-b+sqrt(b^2-4*a*c))/2*a)<<endl;
  24. cout << " phuong trinh co nghiem x2 = "<<float((-b-sqrt(b^2-4*a*c))/2*a);}
  25.  
  26. return(0);
  27. }
Add Comment
Please, Sign In to add comment