Advertisement
tuminh968

Untitled

Oct 23rd, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 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.     int (denta) = b*b - 4*a*c ;
  10.     if (denta > 0){
  11.         cout << "phuong trinh co nghiem x1 = "<< (-b+sqrt(denta))/2*a;
  12.         cout << "phuong trinh co nghiem x2 = "<< (-b-sqrt(denta))/2*a;
  13.     }
  14.     else if (denta = 0){
  15.         cout<< " phuong trinh co nghiem kep x1 = x2 = "<<(-b)/2*a;
  16.     }
  17.     else
  18.     cout << "phuong trinh vo nghiem" ;
  19.     return (0);
  20.    
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement