Advertisement
Guest User

12

a guest
Sep 15th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement