top of page
PROGRAMMING CHALLENGES
Quadratic Equation Solver
Difficulty:
3 Hard
1.2 Arithmetic Operations
Topic:
Write a program that solves quadratic equations of the form ax^2 + bx + c = 0. The program should prompt the user to enter the coefficients a, b, and c, and then calculate and output the real and complex roots of the equation.
INPUTS: Coefficients a, b, and c (floats)
PROCESSES:
1. Accept user input for the coefficients a, b, and c
2. Calculate the discriminant d = b^2 - 4ac
3. Use selection statements to determine the nature of the roots based on the value of the discriminant
4. Calculate the real and complex roots using the quadratic formula
OUTPUTS: Real and/or complex roots of the quadratic equation (floats/complex numbers)
PROCESSES:
1. Accept user input for the coefficients a, b, and c
2. Calculate the discriminant d = b^2 - 4ac
3. Use selection statements to determine the nature of the roots based on the value of the discriminant
4. Calculate the real and complex roots using the quadratic formula
OUTPUTS: Real and/or complex roots of the quadratic equation (floats/complex numbers)
Need help with your programming skills?
If you need more help than just independent practise, then we're here for you. Book a 1:1 with us and we will be able to guide you to becoming a proficient programmer who can tackle any of the challenges an exam board can throw at you.
1 hr
50 British pounds1 hr
55 British pounds
bottom of page