/* Q8: Write a C++ Program to findout the roots of quadratic equation */ #include #include #include main() { clrscr(); float a, b, c, r1, r2, disc; cout << "Enter coefficients a "; cin >>a; cout << "\nEnter coefficients b "; cin >>b; cout << "\nEnter coefficients c "; cin >>c; disc = b*b - 4*a*c; r1 = (-b + sqrt(disc)) / (2*a); r2 = (-b - sqrt(disc)) / (2*a); cout << "\nRoots of the equation are \n"; cout << "Root # 1 = " << r1 <<"\n"; cout << "Root # 2 = " << r2 <<"\n"; getch(); }