Chapter

Computing Quadratic Roots

From ComputerScienceOne by Dr Chris Bourke

Concepts

  1. Why does integer division make the Fahrenheit-to-Celsius program produce zero?

    "Examples use an ampersand when using scanf() : scanf(\"%lf\", &fahrenheit); We can now compute celsius using the formula provided: celsius = (fahrenheit - 32) * (5 / 9); Finally, we use printf() agai

  2. How can a C program compute the roots of a quadratic equation?

    "Some programs require the user to enter multiple inputs. The prompt-input process can be repeated. In this example, consider asking the user for the coefficients, a, b, c to a quadratic polynomial, a

  3. How can quadratic-equation inputs be provided as command-line arguments?

    "This program was interactive. As an alternative, we could have read all three of the inputs as command line arguments, converting them to floating point numbers. Lines 12–17 in the program could have

Computing Quadratic Roots | ComputerScienceOne | Bifalgorithm | Bifalgorithm