SHARE
TWEET

12

a guest Sep 15th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main(){
  6.     int a;
  7.     int b;
  8.     int c;
  9.     int result1;
  10.     int result2;
  11.  
  12.     cout << "Enter value a: ";
  13.     cin >> a;
  14.     cout << "Enter value b: ";
  15.     cin >> b;
  16.     cout << "Enter value c: ";
  17.     cin >> c;
  18.  
  19.     result1 = ((-b)+sqrt(pow(b,2)-4*a*c))/2*a;
  20.     result2 = ((-b)-sqrt(pow(b,2)-4*a*c))/2*a;
  21.  
  22.     system("clear");
  23.     cout << "The roots are "<< result1 <<" and " << result2 << endl;
  24.  
  25.     return 0;
  26.     system("pause");
  27. }
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