velop a C program that computes the different roots in a quadratic equation, aX + bX2=0. r = -b ± √ (b2 – 4ac) , r1 is the root when the + is used in the equation and r2 is the root when 2a the – is used. The roots r1 and r2 can only be computed when the discriminant (b2 – 4ac) is greater than the zero else the quadratic equation does not have any roots and therefore the program should display “no roots”. NOTE: sqrt is a built in function in C to extract the roots. The program will prompt to input the values of a, b and c and output the roots r1 and r2 or no roots at all. Check your answer manually. 2.) Implement a program usi
1.)Implement a program using the if-else selection structure.
Develop a C program that computes the different roots in a quadratic equation, aX + bX2=0.
r = -b ± √ (b2 – 4ac) , r1 is the root when the + is used in the equation and r2 is the root when
2a the – is used. The roots r1 and r2 can only be computed when the discriminant
(b2 – 4ac) is greater than the zero else the quadratic equation does not have any roots and therefore the program should display “no roots”.
NOTE: sqrt is a built in function in C to extract the roots. The program will prompt to input the values of a, b and c and output the roots r1 and r2 or no roots at all. Check your answer manually.
2.) Implement a program using the if-else selection structure.
Input two numbers. Determine and print the larger number, smaller number. Also, print the two numbers in ascending and descending order.
Test data:
Enter 1st number: 4 /*inputs */
Enter 2nd number: 2
Smaller number : 2 /*output */
Larger number : 4 /*output */
Ascending order : 2,4 /*output */
Descending order: 4,2
Step by step
Solved in 2 steps with 2 images