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,r1,r2,d;
- cin>>a>>b>>c;
- d=(pow(b,2)-(4*a*c));
- r1=(-b+sqrt(d))/(2*a);
- r2=(-b-sqrt(d))/(2*a);
- cout.precision(5);
- if(a!=0 && d>0)
- {
- cout<<fixed<<"R1 = "<<r1<<endl;
- cout<<fixed<<"R2 = "<<r2<<endl;
- }
- else{
- cout<<"Impossivel calcular\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement