Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main () {
- long long int a,b,c,D,x1,x2;
- cin>>a>>b>>c;
- D=pow(b,2)-4*a*c;
- x1=(-b-sqrt(D))/(2*a);
- x2=(-b+sqrt(D))/(2*a);
- if(a!=0&&fabs(a)<100&&fabs(b)<100&&fabs(c)<100){
- if(D<0){
- cout<<"No Roots";
- }
- else if(D==0){
- cout<<"One Root:"<<x1;
- }
- else if(D>0){
- cout<<"Two Roots:"<<x1<<" "<<x2;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement