Hope you can help find the error. it wont calculate d and x properly
Matthacker
Code:
#include <stdio.h>
#include <math.h>
int main ( void )
{
float a;
float b;
float c;
float d;
float x;
a = 0, b= 0, c = 0, d = 0, x = 0;
x = (-b +- sqrt(d)) / (2*a);
d = (pow( b, 2)) - (4*a*c);
printf ( "please input the three numbers in the 2nd degree polynomium:");
scanf ("%f%f%f", &a,&b,&c);
printf ( " the polynomium is:" );
{
if ( a < 0 )
printf("%fx^2",a);
else
printf("%fx^2",a);
if ( b < 0 )
printf("%fx",b);
else
printf("+%fx",b);
if ( c < 0 )
printf("%f",c);
else
printf("+%f",c);
printf ( " = 0 \n");
}
printf (" diskriminanten er: %f\n", d);
printf(" x er:%f",x);
return 0;
}