Real roots of a quadratic equation

From Programming In C

Exercise 2.1

Write a C program that reads in 3 real numbers, a, b and c that are the coefficients of a quadratic equation

ax2 + bx + c = 0

The program should calculate the 2 roots of the equation assuming that they are both real. Test your program with the following values

  1. a = 47.2, b = -148.1, c = 72.6
  2. a = -19, b = 67, c = 82

Check your answers with a demonstrator


Next exercise

Return to the course summary

phy225: Course Details

general


compilers


2012-13 assessments


past exam papers

  • 2008-9 (http://physics-database.group.shef.ac.uk/exampapers/2008-09/PHY225%20LT.pdf)
  • 2009-10 (http://physics-database.group.shef.ac.uk/exampapers/2009-10/PHY225%20Exam%20Sem%201%202009-10.pdf)
  • 2010-11 (http://physics-database.group.shef.ac.uk/exampapers/2010-11/PHY225_10_11.pdf)