






mi programa es:
#include<stdio.h>
#include<math.h>
int main()
{
float a,b,c,res1,res2;
printf("Introduce los valores de a,b,c\n");
printf("Valor de A ==> ");scanf("%f",&a);while(getchar()!='\n');
printf("Valor de B ==> ");scanf("%f",&b);while(getchar()!='\n');
printf("Valor de C ==> ");scanf("%f",&c);while(getchar()!='\n');
res1 = (-b+sqrt(b*b-4*a*c))/(2*a);
res2 = (-b-sqrt(b*b-4*a*c))/(2*a);
printf("Positivo %f\n",res1);
printf("Negativo %f\n",res2);
return 0;
}
y el resultado es:
Introduce los valores de a,b,c
Valor de A ==> 1
Valor de B ==> 2
Valor de C ==> 3
Positivo -nan
Negativo -nan