Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. int a,b,c;
  7. int delta=b*b-4*a*c;
  8. int x1,x2;
  9. cout <<"podaj wspolczynniki liczbowe" <<endl;
  10. cout <<"a:";
  11. cin >> a;
  12. cout << endl;
  13. cout <<"b:";
  14. cin >> b;
  15. cout << endl;
  16. cout <<"c:";
  17. cin >> c;
  18. cout << endl;
  19. cout <<"twoja delta wynosi " << delta <<endl;
  20. cout <<" a pierwiastek z delty wynosi " << sqrt(delta)<<endl;
  21. if (delta>0){
  22. x1=-b-sqrt(delta)/2*a;
  23. x2=-b+sqrt(delta)/2*a;
  24. cout << "pierwsze miejsce zerowe wynosi " << x1 << endl;
  25. cout << "drugie miejsce zerowe wynosi " << x2 << endl;
  26. }
  27. else if(delta=0){
  28. x1=-b/2*a;
  29. cout << "miejsce zerowe wynosi " << x1 << endl;
  30. }
  31. else if(delta<0){
  32. cout << "funkcja nie posiada miejsce zerowych" << endl;
  33. }
  34. else if (a=0){
  35. x1 = -c / b;
  36. cout <<"funkcja liniowa wynosi " << x1 <<endl;
  37. }
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44. return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement