#include<stdio.h>
#include<conio.h>
#include<iostream.h>
#include<math.h>
void main()
{
int a,b,c,d;
float x1,x2,p,q;
clrscr();
cout<<"Enter 1st number, a = ";
cin>>a;
cout<<"Enter 2nd number, b = ";
cin>>b;
cout<<"Enter 3rd number, c = ";
cin>>c;
d=b*b-4*a*c;
if(d>0)
{
x1=(-b+sqrt(d))/(2*a);
x2=(-b-sqrt(d))/(2*a);
cout<<"\nX1= "<<x1<<"\nAnd\nX2= "<<x2;
}
else if(d==0)
{
x1=x2=-b/(2*a);
cout<<"\nX1= "<<x1<<"\nAnd\nX2= "<<x2;
}
else
{
p=-b/(2*a);
q=sqrt(-d)/(2*a);
cout<<"\nX1= "<<p<<"+"<<q<<"\nAnd\n"<<"X2= "<<p<<"-"<<q;
}
getch();
}
///////////////////////////////////////////////////////////////////////////
Copy & paste this code in your TC & run, then you will get output.......
If you have any problem please comment below.........