Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

#include <stdio.

h>
#include <math.h>
main ()
{
float a, b, c, d, x1, x2;
printf("entrer a:");
scanf("%f",&a);
printf("entrer b:");
scanf("%f",&b);
printf("entrer c :");
scanf("%f",&c);
if (a==0)
{
if(b==0)
{
if(c==0)
{
printf("Ensemble IR");
}
else
{
printf("Vide");
}
}
else
{
printf("la solution est: %f\n",-c/b);
}
}
else
{
d=b*b-4*a*c;
if(d>0)
{
x1=(-b+sqrt(d))/(2*a);
x2=(-b-sqrt(d))/(2*a);
printf("Solution:\n");
printf("X1=%f\t X2=%f\n",x1,x2);
}
if(d==0)
{
x1=(-b)/(2*a);
printf("Solution:\n");
printf("X1=%f\n",x1);
}
else
{
printf("Solution:\n");
printf("N'admet pas une solution dans IR'");
}
}

You might also like