Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

medu/course/cs101 sp21/flow-session/683531/20/ AdBlock - Chrome... Explore Buftstreams WebAssign Turnitin I Runtime Error scape fro... Facebook I My Housing, Univer Finding and Correcting Bugs 1 point

image text in transcribed
image text in transcribed
medu/course/cs101 sp21/flow-session/683531/20/ AdBlock - Chrome... Explore Buftstreams WebAssign Turnitin I Runtime Error scape fro... Facebook I My Housing, Univer Finding and Correcting Bugs 1 point These exercises ask you to correct a candidate code by identifying the bugs which prevent it from executing and remedying them. Given a quadratic equatin, ax? +bx+c= 0, the two rools are -0+V02 - dac 22 -0 --dac 2a 2a What are the problems with the following program? Correct the program so that it solves the given equation for these values of ab. For a = 2,6 = 5,0 - 2, the two roots should be x = -- and , = -2 These values allow you to test the code below to see if it is correct Remember, just because a piece of code runs, that does not mean that it runs correctly (This assignment is based on Langtangen, Exercise 1.17) Card code O e to search Remember, just because a piece of code runs that does not mean that it runs correctly (This assignment is based on Langtangen, Exercise 1.17.) Starter code click to view ho a,b,c - 2,5,2 4 = bb 4ac 9.sr = q**0.5 x1 = (-b + q_sr) / 2a x2 = (-b-q_sr) / 2*a print( x1,x2) Answers 1 a,b,c -2,5,2 2 q = b*b - 4'arc 3 q sr = q**0.5 4 x1 = (-b+q sr) 72'a 5 X2 = (-B - 9S)/2'a 6 printex1.x2) ton

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions