C Programming Blog

 
 
 
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{
float  a, b, c;
float root1, root2,de,d;
printf(\"enter the values of a, b and c\");
scanf(\"%f%f%f\", &a,&b,&c);
de=(b*b)-4*(a*c);
d=sqrt(de);
root1=(-b+d) /(2.0*a);
root2=(-b-d) /(2.0*a);
printf(\" roots of the equation are %f %f\", root1,root2);
getch();
}

 
 
Didn't find what you were looking for? Find more on Program to obtain roots of a quadratic equation