Transcript

Q WRITE A PROGRAM TO PRINT ROOTS OF QUADRATIC EQUATION #include#includeint main(){int a,b,c;float x1,x2,l;printf(Enter the coefficient of x^2 and x and constant term:);scanf(%d%d%d,&a,&b,&c);printf(Quadratic equation is %d(x^2)+%dx+%d=0.\n,a,b,c);l=sqrt(b*b-4*a*c);x1=(-b+l)/(2*a);x2=(-b-l)/(2*a);if(a==0)printf(It is not a quadratic equation.);elseprintf(Roots of quadratic equation are %g and %g.\n,x1,x2);return 0;}OUTPUT


Top Related