Question: Write a C program that finds the roots of the equation ax2+bx+c=0. The requirements for this program are as follows, please read them carefully before

Write a C program that finds the roots of the equation ax2+bx+c=0. The requirements for this program are as follows, please read them carefully before starting to write your program:

a) Coefficients a,b and c must be scanned in the main program b) Roots must be found according to the following formulas: Delta=b2 -4ac x1=(-b+sqrt(Delta))/2a x2=(-b-sqrt(Delta))/2a c) x1 and x2 must be initialized as zero arrays of size two each. The first element of the array will correspond to the real part of the root while the second part will correspond to the imaginary part. d) Delta and roots must be calculated in either one or two functions outside of the main function. e) Upon calculating Delta, the program must provide (print) an output regarding the sign of Delta and roots (complex, double or real & distinct)

f) After the roots are calculated, they must be printed in main function in the form a+bi where a and b are numbers and i is sqrt(-1) g) Libraries you can use are: stdio.h and math.h

Hint: square root function is included in math.h. However, it takes the square root of the absolute value of the given number. i.e. sqrt(4)=sqrt(-4)=2. You may need to consider this when working with you program.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!