clase de raices
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
float disc, a,b,c;
float X1,X2;
cout << "ingrese aX2 + bX + c " << endl;
cin>>a;
cin>>b;
cin>>c;
disc=pow(b,2)-4*a*c;
//discriminante >0 =0 <=0 //casos especiales
X1=(-b+pow(disc,0.5))/2*a;
X2=(-b-pow(disc,0.5))/2*a;
cout<<"LAS RAICES SON: X1 "<<X1<<endl<<" X2 : "<<X2;
return 0;
}
#include <math.h>
using namespace std;
int main()
{
float disc, a,b,c;
float X1,X2;
cout << "ingrese aX2 + bX + c " << endl;
cin>>a;
cin>>b;
cin>>c;
disc=pow(b,2)-4*a*c;
//discriminante >0 =0 <=0 //casos especiales
X1=(-b+pow(disc,0.5))/2*a;
X2=(-b-pow(disc,0.5))/2*a;
cout<<"LAS RAICES SON: X1 "<<X1<<endl<<" X2 : "<<X2;
return 0;
}
Comentarios
Publicar un comentario