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;
- if (a==0){
- if(b==0)
- {if (c==0)
- cout<< "phuong trinh vo nghiem";
- else {
- cout << "phuong trinh vo so nghiem";}
- else
- cout << "phuong trinh co 1 nghiem ="<<float(-c/b);}
- }
- else{
- cout << " phuong trinh co nghiem x1 = "<<float((-b+sqrt(b^2-4*a*c))/2*a)<<endl;
- cout << " phuong trinh co nghiem x2 = "<<float((-b-sqrt(b^2-4*a*c))/2*a);}
- return(0);
- }
Add Comment
Please, Sign In to add comment