Monday, May 24, 2010

How do you write a c program to calculate the roots of the 2nd order equation: ax^2+bx+c?

The program should include the solutions for the following special cases:


a. a=0


b. b=0


c. c=0


d. a, b, c %26lt; 0


e. b^2 - 4ac %26lt; 0

How do you write a c program to calculate the roots of the 2nd order equation: ax^2+bx+c?
See the wikipedia article below for information about quadratic (i.e. 2nd order) equations. It describes the quadratic formula. The most common way to write a computer program for this task is to write a C version of the quadratic equation.





Then test, test test! Test each of the special cases, as well as more "normal" cases.

snapdragon2

No comments:

Post a Comment