Dsa
Math
Easy
Quadratic Equation Roots
Given the coefficients of a quadratic equation ax^2 + bx + c = 0, determine the real roots of the equation. If there are two distinct real roots, print both. If there is one real root, print it. If there are no real roots, print "No Real Roots".
Input Format:
- Three space-separated integers a, b, c (a != 0, -100 <= b, c <= 100)
Output Format:
- Print the real roots or 'No Real Roots'. If there are two roots, print them in ascending order.
Example:
Input:
1 -3 2
Output:
1.0 2.0
(Explanation: The roots are calculated as (b^2 - 4ac) resulting in two distinct roots).
Key concepts
mathquadraticsroots
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now