//ROOTS OF A QUADRATIC EQUATION #include #include #include void main() { float a,b,c,D,root1,root2; clrscr(); printf("Enter the values for A,B,C in the Quadratic Eqn. AX^2+BX+C"); scanf("%f%f%f",&a,&b,&c); D=b*b-4*a*c; if(D<0) printf("The roots are imaginary"); else if(D==0) { printf("The Roots are Real and Equal"); root1=(-b)/(2*a); printf("\nThe root is:%f",root1); } else { D=sqrt(D); root1=(-b+D)/(2*a); root2=(-b-D)/(2*a); printf("The Roots are Real and UnEqual"); printf("\nThe Ist root is:%f",root1); printf("\nThe IInd root is:%f",root2); } getch(); } /* OUTPUT Enter the values for A, B & C in the Quadratic Eqn. Ax^2+Bx+C: 1 4 4 The Roots are real and equal. The root is -2.000000 */