Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <math.h>
  4.  
  5.  
  6. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  7. using namespace std;
  8. int main(int argc, char** argv) {
  9. int a,b,c;
  10.  
  11.  
  12. cout<<"Podaj a:";
  13. cin>>a;
  14. cout<<"Podaj b:";
  15. cin>>b;
  16. cout<<"Podaj c:";
  17. cin>>c;
  18.  
  19. cout<<a<<"a^2+"<<b<<"x+"<<c<<"0\n";
  20. cout<<"Delta="<<b*b-4*a<<endl;
  21. int delta=b*b-4*a*c;
  22.  
  23. if(delta<0)
  24. {
  25. cout<<"Brak rozwiazan\n";
  26. return 0;
  27. }
  28.  
  29. if(delta==0)
  30. {
  31. cout<<"Jest jedno rozwiazanie\n\n";
  32. cout<<"x1="<<(-b-sqrt(delta))/(2*a);
  33. return 0;
  34. }
  35. cout<<"\n";
  36. cout<<"x1="<<(-b-sqrt(delta))/(2*a);
  37. cout<<"\n";
  38. cout<<"x2="<<(-b+sqrt(delta))/(2*a);
  39.  
  40.  
  41.  
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement