-
You have your won space transport services such as SpaceX. You are testing new rocket designs. As the part of testing new rocket designs, you are checking their launching sequence. Consider you are launching a rocket straight up from 50 meters above ground (height) with 300 m/s velocity. You need to calculate when the rocket would fall down to earth. To solve this, you can represent this entire scenario through a quadratic equation (since we are not considering sending the rocket into space, we do not have to worry about other factors such as weight or drag).
height = gravitational pull on the rocket (g) + velocity (v) + height of launch (l) = 0
-5t2 + 300t + 50 = 0 (or) multiply by (-1) 5t2 - 300t - 50 = 0
Note: height = 0 means the rocket has reached the earth, -5t2 is calculated by 1?2 at2 where a = 9.8 m/s2. So g is always around the value 5.
Write a C program to solve the quadratic equation of rocket launch by computing the roots (t1 and t2) of that quadratic equation: gt2 + vt + l = 0 (or) for simplicity ax2 + bx + c = 0. Get the values of g, v, and l from the user. The program should determine the nature of roots (?)- whether the roots are real or imaginary and should print the roots for each case. The program should also consider the case where a = 0.
?=b2 -4ac(orv2 -4gl)
If ? ? 0 then the roots are real and given by,
?b+?b2 ?4ac
t1 = 2a and t1 =
?b??b2 ?4ac 2a
?b? i?? 2a
Note: Calculate real part and imaginary part separately. To print imaginary roots just add an "i" in printf.

If ? < 0 then the roots are imaginary and given by,
?b + i??
t1 = 2a and t1 =

If a = 0 then it becomes a linear equation and the root is given by,
t = ? bc