Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,195,425 members, 7,958,275 topics. Date: Wednesday, 25 September 2024 at 11:41 AM |
Nairaland Forum / Science/Technology / Programming / Programming CHALLENGE (3) (679 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)
Great Programmers In D House Where R U / Mobile App Developers;i Need Ur Help / Who Is Up For The Google Cloud Developer Challenge
(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 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 9 |