fork download
  1. #include<iostream>
  2. #include<bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. double a,b,c;
  9. cin>>a>>b>>c;
  10. if(a!=0)
  11. {
  12. if(pow(b,2)-4*a*c==0)
  13. cout<<((-b-sqrt(pow(b,2)-4*a*c))/2*a)<<endl;
  14. if(pow(b,2)-4*a*c<0)
  15. cout<<"brak"<<endl;
  16. if(pow(b,2)-4*a*c>0)
  17. {
  18. if(((-b-sqrt(pow(b,2)-4*a*c))/2*a)<((-b+sqrt(pow(b,2)-4*a*c))/2*a))
  19. {
  20. cout<<((-b-sqrt(pow(b,2)-4*a*c))/2*a)<<' ';
  21. cout<<((-b+sqrt(pow(b,2)-4*a*c))/2*a)<<endl;
  22. }
  23. else
  24. {
  25. cout<<((-b+sqrt(pow(b,2)-4*a*c))/2*a)<<' ';
  26. cout<<((-b-sqrt(pow(b,2)-4*a*c))/2*a)<<endl;
  27. }
  28.  
  29. }
  30. }
  31. return 0;
  32. }
  33.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
-0