Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int a,b,c,d,x1,x2,x0;
  9. do {cout<<"podaj wspolczynnik a ";
  10. cin>>a;}
  11. while (a==0);
  12.  
  13. do {cout<<"podaj wspolczynnik b ";
  14. cin>>b;}
  15. while(b==0);
  16. cout<< "podaj wyraz wolny c ";
  17. cin>>c;
  18. d=b*b-4*a*c;
  19. if (d>0)
  20. {
  21. x1=sqrt (d)/2*a;
  22. x2=-(sqrt(d))/2*a;
  23. cout<< "pierwiastek x1 jest rowny ">> x1;
  24. cout<< "pierwiastek x2 jest rowny ">>x2;
  25. }
  26. else if (d==0)
  27. {
  28. x0=-(b)/2*a;
  29. cout<<"pierwiastek x0 jest rowny ">> x0;
  30.  
  31. }
  32.  
  33.  
  34.  
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement