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;
- cin >> a >> b >> c;
- double discriminant = (b * b) - (4 * a * c);
- cout.precision(2);
- if (discriminant < 0){
- cout << "no roots" << endl;
- } else if (discriminant == 0){
- cout << (-b / 2 * a);
- } else {
- cout << (-b + sqrt(discriminant)) / (2 * a) << " " << (-b - sqrt(discriminant)) / (2 * a);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement