Advertisement
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,d,x1,x2,x0;
- do {cout<<"podaj wspolczynnik a ";
- cin>>a;}
- while (a==0);
- do {cout<<"podaj wspolczynnik b ";
- cin>>b;}
- while(b==0);
- cout<< "podaj wyraz wolny c ";
- cin>>c;
- d=b*b-4*a*c;
- if (d>0)
- {
- x1=sqrt (d)/2*a;
- x2=-(sqrt(d))/2*a;
- cout<< "pierwiastek x1 jest rowny ">> x1;
- cout<< "pierwiastek x2 jest rowny ">>x2;
- }
- else if (d==0)
- {
- x0=-(b)/2*a;
- cout<<"pierwiastek x0 jest rowny ">> x0;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement