Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Mar 28th, 2020 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. #include<string>
  3. #include<cmath>
  4. using namespace std;
  5. int main()
  6. {
  7.     double a;
  8.     double b;
  9.     double c;
  10.  
  11.     cin >> a;
  12.     cin >> b;
  13.     cin >> c;
  14.  
  15.     double Discriminant = (b * b) - 4 * a * c;
  16.  
  17.     double sqrtDiscriminant = sqrt(Discriminant);
  18.  
  19.     double firstRoot = (-b - sqrtDiscriminant) / (2 * a);
  20.     double secondRoot= (-b + sqrtDiscriminant) / (2 * a);
  21.  
  22.     if (Discriminant > 0)
  23.     {
  24.         cout << secondRoot << " " << firstRoot << endl;
  25.     }
  26.     else if (Discriminant == 0)
  27.     {
  28.         cout << firstRoot << endl;
  29.     }
  30.     else
  31.     {
  32.         cout << "no roots" << endl;
  33.     }
  34.    
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top