Welcome, Guest: Join Nairaland / LOGIN! / Trending / Recent / NewStats: 2,864,970 members, 6,874,568 topics. Date: Sunday, 22 May 2022 at 02:39 AM |
Nairaland Forum / Science/Technology / Programming / Programming CHALLENGE (3) (617 Views)
Programming Challenge For Beginners Competition Two N20000 -SEASON 2- / Programming Challenge For Beginners N20000 / Facebook Programming Challenge Question (2) (3) (4)
Programming CHALLENGE (3) by elvis10ten(m): 8:01pm On Jul 16, 2013 |
Write a program that will use the method of completing the square to solve a quadratic equation. SAMPLE INPUT: 2x² + 5x - 3 = 0 SAMPLE OUTPUT: x = 1/2 or x = - 3 HINTS 1)Only the addition and substraction operator are allowed in the input equation. 2)Only three co-efficients are used in the equation. RULES 1)Your code must be robust and work with any input. 2)Run your code on www.ideone.com. 3)Fastest and shortest code wins. 4)It should be able to run on a poor cpu. Good luck |
Re: Programming CHALLENGE (3) by ooman(m): 7:53am On Jul 17, 2013 |
x=(-b+math.sqrt(b**2-4*a*c))/(2*a) or x=(-b-math.sqrt(pow(b,2)-4*a*c))/(2*a) all others are simple. note the operator diff after each -b Python. Same applies to Java. |
Re: Programming CHALLENGE (3) by elvis10ten(m): 2:52pm On Jul 17, 2013 |
ooman: x=(-b+math.sqrt(b**2-4*a*c))/(2*a)hello ?. Quadratic formula and completing the square are two different things. Though quadratic formula was derived from completing the square. |
Re: Programming CHALLENGE (3) by ooman(m): 5:52pm On Jul 17, 2013 |
elvis10ten: hello ?. Quadratic formula and completing the square are two different things. Though quadratic formula was derived from completing the square. so your point? |
Re: Programming CHALLENGE (3) by elvis10ten(m): 7:25pm On Jul 17, 2013 |
ooman:Please read the question before posting, it says using completing the square method. |
(1) (Reply)
Php Gurus Help Urgently / Need Help On Vb / Why You Should Mind Your Klout Scores
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2022 Oluwaseun Osewa. All rights reserved. See How To Advertise. 28 |