quadratic equation

2
#include <iostream> #include <math.h> using namespace std; int main() { float a, b,c,x1,x2,determinent; cout<<"enter value of a,b,c"; cin>>a>>b>>c; determinent = (b*b)-(4*a*c); { if(determinent==0) { cout<<"the roots are real and equal"<<endl; x1=x2=(-b/(2*a)); cout<<x1<<x2<<endl; } else if (determinent>0) { cout<<"the roots are real and unequal"<<endl; x1=(-b+sqrt(determinent))/(2*a); x2=(-b-sqrt(determinent))/(2*a); cout<<x1<<" "<<x2<<endl; } else { cout<<"roots are imaginary and cannot be eveluated";

Upload: akash-goyal

Post on 02-Sep-2015

218 views

Category:

Documents


6 download

DESCRIPTION

prog

TRANSCRIPT

#include #include using namespace std;int main()

{ float a, b,c,x1,x2,determinent; couta>>b>>c; determinent = (b*b)-(4*a*c); { if(determinent==0) { cout