C PROGRAMMING ONLY PLEASE! Please add comments so I can understand why you did certain functions.

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

C PROGRAMMING ONLY PLEASE! Please add comments so I can understand why you did certain functions.

Post by answerhappygod »

C PROGRAMMING ONLY PLEASE!
Please add comments so I can understand why you did certainfunctions.
C Programming Only Please Please Add Comments So I Can Understand Why You Did Certain Functions 1
C Programming Only Please Please Add Comments So I Can Understand Why You Did Certain Functions 1 (72.94 KiB) Viewed 27 times
This assignment requires you to solve quadratic equations using the quadratic formula. You will need to write at least three functions and apply a three-way conditional statement. Ask the user for the coefficients a, b and c of a quadratic equation ax² + b + c = 0. -b+/b²-4ac 2a Implement solving for the roots You are required to: • Write a function to determine and return the determinant b² - 4ac from the coefficients. (Hint: This function will make it easy for you to tell how many roots the equation has...) • Write a function to determine and return the first root -b+√√/b²-4ac from the coefficients. 20 • Write a function to determine and return the second root It's up to you how to put together the conditions and output from there. Submit your file as quad.py. Example runs: Enter coefficient b: 4.0 Enter coefficient c: 2.0 That quadratic has one root: -1.0 of the quadratic equation. If there is only one root, print it. If the roots are complex, print an error message. ====== === RESTART: C:/Users/matth/Desktop/quad.py ============ Enter coefficient a: 2.0 ======= ========== RESTART: C:/Users/matth/Desktop/quad.py Enter coefficient a: 2.0 Enter coefficient b: 3.0 Enter coefficient c: 2.0 Sorry, that quadratic has complex roots. ====== ========== RESTART: C:/Users/matth/Desktop/quad.py Enter coefficient a: 2.0 Enter coefficient b: 5.0 Enter coefficient c: 2.0 That quadratic has two roots: -0.5 and -2.0 ========= -b-3b²-4ac 20 ====== ======== from the coefficients. Enter coefficient a: 3.0 Enter coefficient b: 8.0 Enter coefficient c: 2.0 That quadratic has two roots: -0.2792407799438735 and -2.3874258867227933 === === ====== RESTART: C:/Users/matth/Desktop/quad.py ===================
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply