Advertisement
modlicha

Miejsce_zerowe_Zadanie_domowe

Mar 23rd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. double a;
  9. double b;
  10. double c;
  11.  
  12. cin >> a >> b >> c;
  13.  
  14. if(a==0)
  15. {
  16. if(b==0)
  17. {
  18. if(c==0)
  19. {
  20. cout << "NWR" << endl;
  21. }
  22. else
  23. {
  24. cout << "BR" << endl;
  25. }
  26. }
  27. else
  28. {
  29. double x = (- c) / b;
  30. cout << x << endl;
  31. }
  32. }
  33. else
  34. {
  35. if((pow(b,2))-(4*a*c) > 0)
  36. {
  37. double x = ((- b) - (sqrt(pow(b,2))-(4*a*c))) / 2*a;
  38. double y = ((- b) + (sqrt(pow(b,2))-(4*a*c))) / 2*a;
  39. cout << x << " " << y << endl;
  40. }
  41. else
  42. {
  43. if((pow(b,2))-(4*a*c) == 0)
  44. {
  45. double x = (- b) / 2*a;
  46. cout << x << endl;
  47. }
  48. else
  49. {
  50. cout << "BR" << endl;
  51. }
  52. }
  53. }
  54.  
  55.  
  56. return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement