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