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,d,D1,e,f,l;
- double D;
- int x1,x2;
- cout<<"made by Y.Strike\n";
- cout<<"vavedi a\n";
- cin>>a;
- cout<<"vavedi b\n";
- cin>>b;
- cout<<"vavedi c\n";
- cin>>c;
- if(a<=0)
- {
- d=a*(-1);
- e=b*(-1);
- f=c*(-1);
- D=(e*e)-(4*d*f);
- }
- else
- {
- D=(b*b)-(4*a*c);
- }
- if(D<=0)
- {
- cout<<"nqma koreni(diskriminanta po malko ot 0)\n";
- system("pause");
- return 0;
- }
- else
- l=sqrt(D);
- x1=(-b+l)/(2*a);
- x2=(-b-l)/(2*a);
- if(x1==0)
- {
- cout<<"uravnenieto ima samo edin koreen X2="<<x2<<endl;
- system("pause");
- return 0;
- }
- else
- {
- cout<<" X1="<<x1<<" X2="<<x2<<endl;
- system("pause");
- return 0;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement