← Problem book: C
Lesson 29 of 96 · 10 XP
Number of roots of an equation
Theory and problem statement
Machine translation, not yet reviewed by a native speaker.
You are given the coefficients of a quadratic equation a·x² + b·x + c = 0 — integers, a ≠ 0.
Print how many real roots it has: 0, 1 or 2.
Example
Input:
1 -3 2
Output:
2
Sign up for free to solve this task right in your browser: code editor, running, test checks and hints.