Here is the code to print the real roots of the quadretic equation:
#include <stdio.h>
#include <math.h>
main()
{
float a,b,c,root1,root2;
printf("enter the cofficients of a b and c");
scanf("%f %f %f ",&a &b &c);
dis=(b*b)-(4*a*c);
root1=(-b+sqrt(dis))/(2*a);
root2=(-b-sqrt(dis))/(2*a);
printf("root1=%0.2f \n root2= %0.2f",root1,root2);
}
FOR MORE PROGRAMS : CLICK HERE
FOR COMPUTER SCIENCE NOTES: CLICK HERE
Comments
Post a Comment
THANK YOU FOR COMMENTING !
PLEASE SUBSCRIBE TO OUR WEBSITE FOR LATEST UPDATES