#include<stdio.h>
#include<stdlib.h>
#include<math.h>
main()
{
float a,b,c;
float delta,x1,x2;
printf("************** ax+bx^2+c=0
****************\n");
printf(" a = ");
scanf("%f",&a);
printf(" b = ");
scanf("%f",&b);
printf(" c = ");
scanf("%f",&c);
delta=pow(b,2)-4*a*c;
if(delta>0)
{
x1=(-b-sqrt(delta))/(2*a);
x2=(-b+sqrt(delta))/(2*a);
printf("
l'equation admet 2 solutions :\n %2.3f et %2.3f \n",x1,x2);
}
if(delta==0) {
printf("l'equation n'a pas de solution dans IR\n"); }
if(delta<0)
{
x1=(-b)/(2*a);
printf("l'equation
admet une solution double %2.3f \n",x1);
}
system("pause");
}
Commentaires
Enregistrer un commentaire