Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main () {
- double a, b, c, x;
- cin >> a >> b >> c;
- if ((b*b - 4*a*c) >= 0) {
- x = ((-1)*b + sqrt(b*b - 4*a*c))/(2*a);
- cout << x << " ";
- x = ((-1)*b - sqrt(b*b - 4*a*c))/(2*a);
- cout << x << endl;
- }
- if ((b*b - 4*a*c) == 0) {
- x = ((-1)*b)/(2*a);
- cout << x << " ";
- cout << x << endl;
- }
- cout << x;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement