Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main () {
  6. double a, b, c, x;
  7. cin >> a >> b >> c;
  8. if ((b*b - 4*a*c) >= 0) {
  9. x = ((-1)*b + sqrt(b*b - 4*a*c))/(2*a);
  10. cout << x << " ";
  11. x = ((-1)*b - sqrt(b*b - 4*a*c))/(2*a);
  12. cout << x << endl;
  13. } else {
  14. if ((b*b - 4*a*c) = 0) {
  15. x = ((-1)*b)/(2*a);
  16. cout << x << " ";
  17. cout << x << endl;
  18. }
  19. } else {
  20. cout << x;
  21. }
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement