A blog to help students to learn programming in various languages including C, C++, Java, Python and many more.

Subscribe For Free Latest Updates!

We'll not spam mate! We promise.

Saturday 23 January 2016



Program Screenshot
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



Copyright © 2016 - ProgrmIt - All Rights Reserved
(Articles Cannot Be Reproduced Without Author Permission.)
Design By : | Powered By: Blogger