===========================================================================
CODING
#include<iostream.h>
#include<conio.h>
#include<math.h>
float check(float,float,float);
void main()
{
clrscr();
float a,b,c,i;
cout<<"Enter Quadratic Equation: (a)*xý+(b)*x+(c)";
cout<<"\n Enter coffecient of xý (a): ";
cin>>a;
cout<<"\n Enter coffecient of x (b): ";
cin>>b;
cout<<"\n Enter constant (c): ";
cin>>c;
i=check(a,b,c);
if(i==0)
cout<<"\n\nEquation has Real and Equal roots";
else if(i==1)
cout<<"\n\nEquation has Real roots";
else if(i==-1)
cout<<"\n\nEquation has Imaginary roots";
getch();
}
float check(float a,float b,float c)
{
float D;
D=(b*b)-(4*a*c);
if(D==0)
return 0;
else if(D>0)
return 1;
else if(D<0)
return -1;
}
CODING
#include<iostream.h>
#include<conio.h>
#include<math.h>
float check(float,float,float);
void main()
{
clrscr();
float a,b,c,i;
cout<<"Enter Quadratic Equation: (a)*xý+(b)*x+(c)";
cout<<"\n Enter coffecient of xý (a): ";
cin>>a;
cout<<"\n Enter coffecient of x (b): ";
cin>>b;
cout<<"\n Enter constant (c): ";
cin>>c;
i=check(a,b,c);
if(i==0)
cout<<"\n\nEquation has Real and Equal roots";
else if(i==1)
cout<<"\n\nEquation has Real roots";
else if(i==-1)
cout<<"\n\nEquation has Imaginary roots";
getch();
}
float check(float a,float b,float c)
{
float D;
D=(b*b)-(4*a*c);
if(D==0)
return 0;
else if(D>0)
return 1;
else if(D<0)
return -1;
}
===========================================================================
No comments:
Post a Comment