Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- double a,b,c;
- double x=0;
- cin>>a>>b>>c;
- double delta = (b*b)-(4*a*c);
- if(a==0)
- {
- if(b==0)
- {
- if(c==0)
- {
- cout<<"NWR"<<endl;
- }
- else
- cout<<"BR"<<endl;
- }
- else
- {
- double x=-b/c;
- cout<<x;
- }
- }
- else
- if(delta>0)
- {
- double x1=(-b-(sqrt(delta)))/(2*a);
- double x2=(-b+(sqrt(delta)))/(2*a);
- cout.precision(2);
- cout<<fixed<<"x1= "<<x1<<endl;
- cout<<fixed<<"x2= "<<x2<<endl;
- }
- else
- if(delta==0)
- {
- double xx=-b/2*a;
- cout<<xx;
- }
- else
- cout<<"BR";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement