Program to find all roots of quadratic equations.

#include<iostream>
#include<math.h>
using namespace std;
int main()
{
float a,b,c,d,e;
cout<<"Enter the values of a,b,c"<<endl;
cin>>a>>b>>c;
d=(sqrt(pow(b,2)-(4*a*c)));
float f=(-b+d)/(2*a);
float g=(-b-d)/(2*a);
cout<<"for - "<<g<<endl<<"for + "<<f<<endl;
e=pow(b,2)-(4*a*c);
if (e>0)
cout<<"real and unequal\n\n";
else if(e<0)
cout<<"imaginary\n\n";
else
cout<<"real and equal\n\n";
cout<<"/*\nName-Sanjampreet Singh\nRoll Number-1507967\n*/";
}

Output:


Comments

Popular posts from this blog

Program to illustrate the concept of templates.

To create an html file to implement the concept of margin, padding using cascading style sheets.

To configure the IP address for a computer connected to LAN