Output |
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int a,b,c,d=0,x;
cout<<"Enter a,b & c:";
cin>>a>>b>>c;
d=(b*b)-4*a*c;
cout<<"Result:\n";
if(d<0) {
cout<<"d<0"<<endl;
cout<<(-b-sqrt(d))/2*a<<endl;
cout<<(-b+sqrt(d))/2*a<<endl;
} else if(d==0) {
cout<<"D=0"<<endl;
cout<<-b/2*a<<endl;;
} else {
cout<<"D>0"<<endl;
cout<<"Imaginary number: "<<endl;
}
}
0 comments :
Post a Comment